forked from Silverfish/proton-bridge
Reduce number of synchronizations GODT-313
* [x] expononential cooldown of retries * [x] do not trigger sync by counts * [x] randomization of event poll interval
This commit is contained in:
@ -104,6 +104,7 @@ type Store struct {
|
||||
imapUpdates chan interface{}
|
||||
|
||||
isSyncRunning bool
|
||||
syncCooldown cooldown
|
||||
addressMode addressMode
|
||||
}
|
||||
|
||||
@ -148,6 +149,9 @@ func New(
|
||||
log: l,
|
||||
}
|
||||
|
||||
// Minimal increase is event pollInterval, doubles every failed retry up to 5 minutes.
|
||||
store.syncCooldown.setExponentialWait(pollInterval, 2, 5*time.Minute)
|
||||
|
||||
if err = store.init(firstInit); err != nil {
|
||||
l.WithError(err).Error("Could not initialise store, attempting to close")
|
||||
if storeCloseErr := store.Close(); storeCloseErr != nil {
|
||||
|
||||
Reference in New Issue
Block a user