Pre expire tokens

This commit is contained in:
M66B
2021-07-17 10:12:55 +02:00
parent 35fe0d2688
commit 0a417725eb
3 changed files with 48 additions and 9 deletions

View File

@@ -1265,8 +1265,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
db.folder().setFolderStates(account.id, null);
db.account().setAccountState(account.id, "connecting");
ServiceAuthenticator authenticator;
try {
iservice.connect(account);
authenticator = iservice.connect(account);
} catch (Throwable ex) {
// Immediately report auth errors
if (ex instanceof AuthenticationFailedException) {
@@ -1855,6 +1856,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
"Unrecoverable",
new Exception(state.getUnrecoverable()));
if (!authenticator.isTokenValid(account.poll_interval))
throw new StoreClosedException(iservice.getStore(), "Token invalidation");
// Sends store NOOP
if (EmailService.SEPARATE_STORE_CONNECTION) {
EntityLog.log(this, account.name + " checking store" +