mirror of https://github.com/M66B/FairEmail.git
Auto keep alive tuning
This commit is contained in:
parent
020454af87
commit
567681c08f
|
@ -1168,9 +1168,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
||||||
if (BuildConfig.DEBUG &&
|
if (BuildConfig.DEBUG &&
|
||||||
!first && !account.keep_alive_ok &&
|
!first && !account.keep_alive_ok &&
|
||||||
account.poll_interval > 9 &&
|
account.poll_interval > 9 &&
|
||||||
state.getIdleTime() > (account.poll_interval - 1) * 60 * 1000L) {
|
Math.abs(state.getIdleTime() - account.poll_interval * 60 * 1000L) < 60 * 1000L) {
|
||||||
account.keep_alive_failed++;
|
account.keep_alive_failed++;
|
||||||
if (account.keep_alive_failed > 10) {
|
if (account.keep_alive_failed >= 3) {
|
||||||
account.keep_alive_failed = 0;
|
account.keep_alive_failed = 0;
|
||||||
account.poll_interval--;
|
account.poll_interval--;
|
||||||
db.account().setAccountKeepAliveInterval(account.id, account.poll_interval);
|
db.account().setAccountKeepAliveInterval(account.id, account.poll_interval);
|
||||||
|
@ -1187,7 +1187,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
||||||
if (BuildConfig.DEBUG &&
|
if (BuildConfig.DEBUG &&
|
||||||
!first && !account.keep_alive_ok &&
|
!first && !account.keep_alive_ok &&
|
||||||
account.poll_interval > 9 &&
|
account.poll_interval > 9 &&
|
||||||
state.getIdleTime() > (account.poll_interval - 1) * 60 * 1000L) {
|
Math.abs(state.getIdleTime() - account.poll_interval * 60 * 1000L) < 60 * 1000L) {
|
||||||
account.keep_alive_ok = true;
|
account.keep_alive_ok = true;
|
||||||
db.account().setAccountKeepAliveOk(account.id, true);
|
db.account().setAccountKeepAliveOk(account.id, true);
|
||||||
EntityLog.log(ServiceSynchronize.this, account.name + " keep alive ok");
|
EntityLog.log(ServiceSynchronize.this, account.name + " keep alive ok");
|
||||||
|
|
Loading…
Reference in New Issue