mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 09:47:13 +00:00
Added expedite tolerance
This commit is contained in:
parent
4b79f6bbee
commit
4452f1c1b2
2 changed files with 8 additions and 1 deletions
|
@ -151,6 +151,8 @@ public class ServiceAuthenticator extends Authenticator {
|
|||
long now = new Date().getTime();
|
||||
Long expiration = authState.getAccessTokenExpirationTime();
|
||||
boolean needsRefresh = (expiration != null && expiration < now);
|
||||
if (needsRefresh)
|
||||
authState.setNeedsTokenRefresh(true);
|
||||
|
||||
if (!needsRefresh && forceRefresh &&
|
||||
expiration != null &&
|
||||
|
|
|
@ -64,6 +64,8 @@ import com.sun.mail.imap.IMAPStore;
|
|||
import com.sun.mail.imap.protocol.IMAPProtocol;
|
||||
import com.sun.mail.imap.protocol.IMAPResponse;
|
||||
|
||||
import net.openid.appauth.AuthState;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -2356,7 +2358,10 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
|
||||
if (!account.isTransient(this)) {
|
||||
Long expirationTime = iservice.getAccessTokenExpirationTime();
|
||||
if (expirationTime != null && expirationTime < trigger) {
|
||||
if (expirationTime != null &&
|
||||
expirationTime < trigger &&
|
||||
expirationTime > new Date().getTime()) {
|
||||
expirationTime += AuthState.EXPIRY_TIME_TOLERANCE_MS;
|
||||
EntityLog.log(this, EntityLog.Type.Debug, "Expedite keep alive" +
|
||||
" from " + new Date(trigger) + " to " + new Date(expirationTime));
|
||||
trigger = expirationTime;
|
||||
|
|
Loading…
Reference in a new issue