Procházet zdrojové kódy

Prevent update check from slowing app init

Previously, we'd wait for a response before finishing app
initialization, meaning an overall slower startup. This fixes that.

Ref T572
admin-dashboard-redesign
Matt Baer před 4 roky
rodič
revize
d17e82d34c
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. +2
    -1
      updates.go

+ 2
- 1
updates.go Zobrazit soubor

@@ -100,7 +100,7 @@ func newUpdatesCache(expiry time.Duration) *updatesCache {
frequency: expiry,
currentVersion: "v" + softwareVer,
}
cache.CheckNow()
go cache.CheckNow()
return &cache
}

@@ -117,6 +117,7 @@ func newVersionCheck() (string, error) {
if debugging {
log.Info("[update check] GET https://version.writefreely.org")
}
// TODO: return error if statusCode != OK
if err == nil && res.StatusCode == http.StatusOK {
defer res.Body.Close()



Načítá se…
Zrušit
Uložit