From d6c4512cee1c9c9871d0924e91b45f677459fe33 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sat, 10 Jun 2023 11:51:50 -0700 Subject: [PATCH] Tweak BareRTC watch worker --- pkg/worker/barertc.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/worker/barertc.go b/pkg/worker/barertc.go index 8763ae9..e887866 100644 --- a/pkg/worker/barertc.go +++ b/pkg/worker/barertc.go @@ -46,8 +46,8 @@ func WatchBareRTC() { DoCheckBareRTC() // And on an interval forever. - ticker := time.NewTicker(config.ChatStatusRefreshInterval) - for range ticker.C { + for { + time.Sleep(config.ChatStatusRefreshInterval) DoCheckBareRTC() } } @@ -68,7 +68,7 @@ func DoCheckBareRTC() { } client := http.Client{ - Timeout: 30 * time.Second, + Timeout: 10 * time.Second, } res, err := client.Do(req) @@ -76,6 +76,10 @@ func DoCheckBareRTC() { log.Error("WatchBareRTC: request error: %s", err) cachedChatStatistics = nil return + } else if res.StatusCode != http.StatusOK { + log.Error("WatchBareRTC: didn't get expected 200 OK from statistics endpoint, instead got: %s", res.Status) + cachedChatStatistics = nil + return } if res.StatusCode == http.StatusOK {