Auto keep alive tuning

This commit is contained in:
M66B 2019-12-29 17:00:38 +01:00
parent 020454af87
commit 567681c08f
1 changed files with 3 additions and 3 deletions

View File

@ -1168,9 +1168,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
if (BuildConfig.DEBUG &&
!first && !account.keep_alive_ok &&
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++;
if (account.keep_alive_failed > 10) {
if (account.keep_alive_failed >= 3) {
account.keep_alive_failed = 0;
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 &&
!first && !account.keep_alive_ok &&
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;
db.account().setAccountKeepAliveOk(account.id, true);
EntityLog.log(ServiceSynchronize.this, account.name + " keep alive ok");