Tweak BareRTC watch worker
This commit is contained in:
parent
78abee6e9e
commit
d6c4512cee
|
@ -46,8 +46,8 @@ func WatchBareRTC() {
|
||||||
DoCheckBareRTC()
|
DoCheckBareRTC()
|
||||||
|
|
||||||
// And on an interval forever.
|
// And on an interval forever.
|
||||||
ticker := time.NewTicker(config.ChatStatusRefreshInterval)
|
for {
|
||||||
for range ticker.C {
|
time.Sleep(config.ChatStatusRefreshInterval)
|
||||||
DoCheckBareRTC()
|
DoCheckBareRTC()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ func DoCheckBareRTC() {
|
||||||
}
|
}
|
||||||
|
|
||||||
client := http.Client{
|
client := http.Client{
|
||||||
Timeout: 30 * time.Second,
|
Timeout: 10 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := client.Do(req)
|
res, err := client.Do(req)
|
||||||
|
@ -76,6 +76,10 @@ func DoCheckBareRTC() {
|
||||||
log.Error("WatchBareRTC: request error: %s", err)
|
log.Error("WatchBareRTC: request error: %s", err)
|
||||||
cachedChatStatistics = nil
|
cachedChatStatistics = nil
|
||||||
return
|
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 {
|
if res.StatusCode == http.StatusOK {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user