mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-04 03:43:55 +01:00
Fixed backoff blocking stop
This commit is contained in:
@@ -313,16 +313,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||||||
queue.submit(new Runnable() {
|
queue.submit(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
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<>();
|
Map<String, String> crumb = new HashMap<>();
|
||||||
crumb.put("account", accountNetworkState.toString());
|
crumb.put("account", accountNetworkState.toString());
|
||||||
crumb.put("connected", Boolean.toString(accountNetworkState.networkState.isConnected()));
|
crumb.put("connected", Boolean.toString(accountNetworkState.networkState.isConnected()));
|
||||||
@@ -691,6 +681,16 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||||||
try {
|
try {
|
||||||
wlAccount.acquire();
|
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);
|
final DB db = DB.getInstance(this);
|
||||||
|
|
||||||
int backoff = CONNECT_BACKOFF_START;
|
int backoff = CONNECT_BACKOFF_START;
|
||||||
|
|||||||
Reference in New Issue
Block a user