lot of temp magick files created in temporary folder

前端 未结 3 1052
走了就别回头了
走了就别回头了 2021-01-07 10:23

I am using the imagick library to resizing and cropping the images in a http handler. Which doesn\'t write anything in /tmp folder. But as i can a lot of these

3条回答
  •  一个人的身影
    2021-01-07 10:44

    Actually it should be included in the func main() not in the func serveHTTP(). It is meant to be called once for a long running application and it solved my problem.

    func main() {   
    
        imagick.Initialize() 
        defer imagick.Terminate()                                        
        myMux := http.NewServeMux()
        myMux.HandleFunc("/", serveHTTP)
    
        if err := http.ListenAndServe(":8085", myMux); err != nil {
            logFatal("Error when starting or running http server: %v", err)
        }       
    
    }
    
    func serveHTTP(w http.ResponseWriter, r *http.Request) {
    
    }
    

提交回复
热议问题