+ app: disable new version check and auto-update by command line switch

This commit is contained in:
Simon Zolin
2019-05-27 18:48:33 +03:00
parent b9df476c5d
commit f25639f1fc
4 changed files with 15 additions and 0 deletions

View File

@@ -52,6 +52,11 @@ func getVersionResp(data []byte) []byte {
func handleGetVersionJSON(w http.ResponseWriter, r *http.Request) {
log.Tracef("%s %v", r.Method, r.URL)
if config.disableUpdate {
log.Tracef("New app version check is disabled by user")
return
}
now := time.Now()
controlLock.Lock()
cached := now.Sub(versionCheckLastTime) <= versionCheckPeriod && len(versionCheckJSON) != 0