From d17e82d34c39c79c48b0b091cd3b2fd805c90b0c Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Tue, 25 Feb 2020 14:12:54 -0500 Subject: [PATCH] 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 --- updates.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/updates.go b/updates.go index 9f4c3c0..8ecccf6 100644 --- a/updates.go +++ b/updates.go @@ -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()