mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-28 20:06:29 +01:00
Expedite keep alive time for token refresh
This commit is contained in:
@@ -2239,10 +2239,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
||||
throw new StoreClosedException(iservice.getStore(), "Unrecoverable", cause);
|
||||
}
|
||||
|
||||
// Check token expiration
|
||||
if (!account.isTransient(this))
|
||||
iservice.check();
|
||||
|
||||
// Sends store NOOP
|
||||
if (EmailService.SEPARATE_STORE_CONNECTION) {
|
||||
EntityLog.log(this, EntityLog.Type.Account, account,
|
||||
@@ -2357,6 +2353,16 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
||||
try {
|
||||
long duration = account.poll_interval * 60 * 1000L;
|
||||
long trigger = System.currentTimeMillis() + duration;
|
||||
|
||||
if (!account.isTransient(this)) {
|
||||
Long expirationTime = iservice.getAccessTokenExpirationTime();
|
||||
if (expirationTime != null && expirationTime < trigger) {
|
||||
EntityLog.log(this, EntityLog.Type.Debug, "Expedite keep alive" +
|
||||
" from " + new Date(trigger) + " to " + new Date(expirationTime));
|
||||
trigger = expirationTime;
|
||||
}
|
||||
}
|
||||
|
||||
EntityLog.log(this, EntityLog.Type.Account, account,
|
||||
"### " + account.name + " keep alive" +
|
||||
" wait=" + account.poll_interval + " until=" + new Date(trigger));
|
||||
|
||||
Reference in New Issue
Block a user