Bring back stop delay

This commit is contained in:
M66B 2019-07-28 17:05:43 +02:00
parent 9be0e5c788
commit 8a8ca574cd
1 changed files with 9 additions and 2 deletions

View File

@ -113,6 +113,7 @@ public class ServiceSynchronize extends ServiceBase {
private static final int ACCOUNT_ERROR_AFTER = 60; // minutes
private static final int BACKOFF_ERROR_AFTER = 16; // seconds
private static final long ONESHOT_DURATION = 90 * 1000L; // milliseconds
private static final long STOP_DELAY = 5000L; // milliseconds
static final int PI_ALARM = 1;
static final int PI_ONESHOT = 2;
@ -453,8 +454,14 @@ public class ServiceSynchronize extends ServiceBase {
EntityLog.log(ServiceSynchronize.this, "Reload done queued=" + queued);
if (!doStart && queued == 0 && !isEnabled()) {
stopped = true;
stopService(lastStartId);
try {
Thread.sleep(STOP_DELAY);
} catch (InterruptedException ignored) {
}
if (queued == 0 && !isEnabled()) {
stopped = true;
stopService(lastStartId);
}
}
wl.release();