Optimize keep alive < 12 minutes

This commit is contained in:
M66B 2020-07-06 08:47:29 +02:00
parent faa3e11b3b
commit 8f858a3f35
1 changed files with 2 additions and 1 deletions

View File

@ -105,6 +105,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
private static final long QUIT_DELAY = 5 * 1000L; // milliseconds private static final long QUIT_DELAY = 5 * 1000L; // milliseconds
private static final long STILL_THERE_THRESHOLD = 3 * 60 * 1000L; // milliseconds private static final long STILL_THERE_THRESHOLD = 3 * 60 * 1000L; // milliseconds
static final int DEFAULT_POLL_INTERVAL = 0; // minutes static final int DEFAULT_POLL_INTERVAL = 0; // minutes
private static final int OPTIMIZE_KEEP_ALIVE_INTERVAL = 12; // minutes
private static final int OPTIMIZE_POLL_INTERVAL = 15; // minutes private static final int OPTIMIZE_POLL_INTERVAL = 15; // minutes
private static final int CONNECT_BACKOFF_START = 8; // seconds private static final int CONNECT_BACKOFF_START = 8; // seconds
private static final int CONNECT_BACKOFF_MAX = 32; // seconds (totally ~1 minutes) private static final int CONNECT_BACKOFF_MAX = 32; // seconds (totally ~1 minutes)
@ -952,7 +953,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
final boolean capIdle = iservice.hasCapability("IDLE"); final boolean capIdle = iservice.hasCapability("IDLE");
Log.i(account.name + " idle=" + capIdle); Log.i(account.name + " idle=" + capIdle);
if (!capIdle || account.poll_interval < OPTIMIZE_POLL_INTERVAL) if (!capIdle || account.poll_interval < OPTIMIZE_KEEP_ALIVE_INTERVAL)
optimizeAccount(ServiceSynchronize.this, account, "IDLE"); optimizeAccount(ServiceSynchronize.this, account, "IDLE");
db.account().setAccountState(account.id, "connected"); db.account().setAccountState(account.id, "connected");