mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-06-08 08:52:27 +02:00
Reuse backoff waiting code for errors during GeoIP update.
This commit is contained in:
parent
f6fe960534
commit
a68454ceec
15
hub.go
15
hub.go
|
@ -417,19 +417,20 @@ func (h *Hub) updateGeoDatabase() {
|
|||
}
|
||||
|
||||
defer h.geoipUpdating.Store(false)
|
||||
delay := time.Second
|
||||
backoff, err := NewExponentialBackoff(time.Second, 5*time.Minute)
|
||||
if err != nil {
|
||||
log.Printf("Could not create exponential backoff: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
for !h.closer.IsClosed() {
|
||||
err := h.geoip.Update()
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
|
||||
log.Printf("Could not update GeoIP database, will retry later (%s)", err)
|
||||
time.Sleep(delay)
|
||||
delay = delay * 2
|
||||
if delay > 5*time.Minute {
|
||||
delay = 5 * time.Minute
|
||||
}
|
||||
log.Printf("Could not update GeoIP database, will retry in %s (%s)", backoff.NextWait(), err)
|
||||
backoff.Wait(context.Background())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue