mirror of https://github.com/M66B/FairEmail.git
Limit requiring token refresh
This commit is contained in:
parent
3ad05caa88
commit
e325409c26
|
@ -56,7 +56,7 @@ public class ServiceAuthenticator extends Authenticator {
|
||||||
static final int AUTH_TYPE_GMAIL = 2;
|
static final int AUTH_TYPE_GMAIL = 2;
|
||||||
static final int AUTH_TYPE_OAUTH = 3;
|
static final int AUTH_TYPE_OAUTH = 3;
|
||||||
|
|
||||||
static final long MIN_EXPIRE_INTERVAL = 15 * 60 * 1000L;
|
static final long MIN_EXPIRE_INTERVAL = 12 * 60 * 1000L;
|
||||||
|
|
||||||
ServiceAuthenticator(
|
ServiceAuthenticator(
|
||||||
Context context,
|
Context context,
|
||||||
|
@ -140,7 +140,7 @@ public class ServiceAuthenticator extends Authenticator {
|
||||||
Log.e(ex);
|
Log.e(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
long slack = Math.min(keep_alive, 30 * 60 * 1000L);
|
long slack = Math.max(keep_alive, MIN_EXPIRE_INTERVAL);
|
||||||
if (expiration != null && expiration - slack < new Date().getTime())
|
if (expiration != null && expiration - slack < new Date().getTime())
|
||||||
throw new IllegalStateException(Log.TOKEN_REFRESH_REQUIRED);
|
throw new IllegalStateException(Log.TOKEN_REFRESH_REQUIRED);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue