mirror of https://github.com/M66B/FairEmail.git
Added account wakeup failsafe
This commit is contained in:
parent
de76322f8d
commit
c0a6b79bb4
|
@ -4036,9 +4036,13 @@ class Core {
|
||||||
thread.setPriority(THREAD_PRIORITY_BACKGROUND);
|
thread.setPriority(THREAD_PRIORITY_BACKGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
void release() {
|
boolean release() {
|
||||||
|
if (!thread.isAlive())
|
||||||
|
return false;
|
||||||
|
|
||||||
semaphore.release();
|
semaphore.release();
|
||||||
yield();
|
yield();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean acquire(long milliseconds) throws InterruptedException {
|
boolean acquire(long milliseconds) throws InterruptedException {
|
||||||
|
|
|
@ -765,11 +765,18 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
long account = Long.parseLong(action.split(":")[1]);
|
long account = Long.parseLong(action.split(":")[1]);
|
||||||
Core.State state = coreStates.get(account);
|
Core.State state = coreStates.get(account);
|
||||||
|
|
||||||
|
boolean ok = false;
|
||||||
if (state == null)
|
if (state == null)
|
||||||
EntityLog.log(this, "### wakeup missing account=" + account);
|
EntityLog.log(this, "### wakeup missing account=" + account);
|
||||||
else {
|
else {
|
||||||
EntityLog.log(this, "### waking up account=" + account);
|
EntityLog.log(this, "### waking up account=" + account);
|
||||||
state.release();
|
ok = state.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ok) {
|
||||||
|
Log.e("Wakeup failed account=" + account);
|
||||||
|
reload(this, account, false, "wakeup failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue