Fixed backoff blocking stop

This commit is contained in:
M66B 2019-12-08 09:14:29 +01:00
parent 00ef6cd812
commit e4e180bbab
1 changed files with 10 additions and 10 deletions

View File

@ -313,16 +313,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
queue.submit(new Runnable() {
@Override
public void run() {
long ago = new Date().getTime() - lastLost;
if (ago < RECONNECT_BACKOFF)
try {
long backoff = RECONNECT_BACKOFF - ago;
EntityLog.log(ServiceSynchronize.this, accountNetworkState + " backoff=" + (backoff / 1000));
Thread.sleep(backoff);
} catch (InterruptedException ex) {
Log.w(accountNetworkState + " backoff " + ex.toString());
}
Map<String, String> crumb = new HashMap<>();
crumb.put("account", accountNetworkState.toString());
crumb.put("connected", Boolean.toString(accountNetworkState.networkState.isConnected()));
@ -691,6 +681,16 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
try {
wlAccount.acquire();
long ago = new Date().getTime() - lastLost;
if (ago < RECONNECT_BACKOFF)
try {
long backoff = RECONNECT_BACKOFF - ago;
EntityLog.log(ServiceSynchronize.this, account.name + " backoff=" + (backoff / 1000));
state.acquire(backoff);
} catch (InterruptedException ex) {
Log.w(account.name + " backoff " + ex.toString());
}
final DB db = DB.getInstance(this);
int backoff = CONNECT_BACKOFF_START;