mirror of https://github.com/M66B/FairEmail.git
Fixed stop after reconnect back-off
This commit is contained in:
parent
f5ee1c2953
commit
f827d335be
|
@ -2319,7 +2319,7 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void start() {
|
private void start() {
|
||||||
EntityLog.log(ServiceSynchronize.this, "Main start queued=" + queued);
|
EntityLog.log(ServiceSynchronize.this, "Main start");
|
||||||
|
|
||||||
state = new ServiceState();
|
state = new ServiceState();
|
||||||
state.runnable(new Runnable() {
|
state.runnable(new Runnable() {
|
||||||
|
@ -2347,10 +2347,10 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
try {
|
try {
|
||||||
long backoff = RECONNECT_BACKOFF - ago;
|
long backoff = RECONNECT_BACKOFF - ago;
|
||||||
EntityLog.log(ServiceSynchronize.this, "Main backoff=" + (backoff / 1000));
|
EntityLog.log(ServiceSynchronize.this, "Main backoff=" + (backoff / 1000));
|
||||||
state.acquire(backoff);
|
if (state.acquire(backoff))
|
||||||
|
return;
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
Log.w(Helper.TAG, "main backoff " + ex.toString());
|
Log.w(Helper.TAG, "main backoff " + ex.toString());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start monitoring outbox
|
// Start monitoring outbox
|
||||||
|
@ -2570,8 +2570,8 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
semaphore.acquire();
|
semaphore.acquire();
|
||||||
}
|
}
|
||||||
|
|
||||||
void acquire(long milliseconds) throws InterruptedException {
|
boolean acquire(long milliseconds) throws InterruptedException {
|
||||||
semaphore.tryAcquire(milliseconds, TimeUnit.MILLISECONDS);
|
return semaphore.tryAcquire(milliseconds, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void error() {
|
void error() {
|
||||||
|
|
Loading…
Reference in New Issue