Tweak BareRTC watch worker

face-detect
Noah Petherbridge 2023-06-10 11:51:50 -07:00
parent 78abee6e9e
commit d6c4512cee
1 changed files with 7 additions and 3 deletions

View File

@ -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 {