mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-23 22:51:02 +00:00
Incremental fast error backoff
This commit is contained in:
parent
031d051a55
commit
cf82fa02d5
2 changed files with 9 additions and 4 deletions
|
@ -4076,8 +4076,8 @@ class Core {
|
|||
return networkState;
|
||||
}
|
||||
|
||||
void setBackoff(int value) {
|
||||
this.backoff = value;
|
||||
void setBackoff(int seconds) {
|
||||
this.backoff = seconds;
|
||||
}
|
||||
|
||||
int getBackoff() {
|
||||
|
|
|
@ -1555,8 +1555,13 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
EntityLog.log(ServiceSynchronize.this,
|
||||
account.name + " fast errors=" + errors +
|
||||
" last connected: " + new Date(account.last_connected));
|
||||
if (errors >= FAST_ERROR_COUNT)
|
||||
state.setBackoff(CONNECT_BACKOFF_AlARM_START * 60);
|
||||
if (errors >= FAST_ERROR_COUNT) {
|
||||
int scale = errors - FAST_ERROR_COUNT + 1;
|
||||
int backoff = Math.max(CONNECT_BACKOFF_AlARM_START * scale, CONNECT_BACKOFF_AlARM_MAX);
|
||||
EntityLog.log(ServiceSynchronize.this,
|
||||
account.name + " fast error backoff=" + backoff);
|
||||
state.setBackoff(backoff * 60);
|
||||
}
|
||||
}
|
||||
|
||||
// Report account connection error
|
||||
|
|
Loading…
Reference in a new issue