代码拉取完成,页面将自动刷新
package main
import (
"log"
"os"
"os/signal"
"runtime"
"runtime/debug"
"syscall"
"time"
)
const version = "2.7.0"
type ctxKey string
func initialize() {
log.SetOutput(os.Stdout)
initLog()
configure()
initNewrelic()
initPrometheus()
initDownloading()
initErrorsReporting()
initVips()
if err := checkPresets(conf.Presets); err != nil {
shutdownVips()
logFatal(err.Error())
}
}
func main() {
initialize()
go func() {
var logMemStats = len(os.Getenv("IMGPROXY_LOG_MEM_STATS")) > 0
for range time.Tick(time.Duration(conf.FreeMemoryInterval) * time.Second) {
debug.FreeOSMemory()
if logMemStats {
var m runtime.MemStats
runtime.ReadMemStats(&m)
logDebug("MEMORY USAGE: Sys=%d HeapIdle=%d HeapInuse=%d", m.Sys/1024/1024, m.HeapIdle/1024/1024, m.HeapInuse/1024/1024)
}
}
}()
s := startServer()
stop := make(chan os.Signal, 1)
signal.Notify(stop, syscall.SIGINT, syscall.SIGTERM)
<-stop
shutdownServer(s)
shutdownVips()
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。