Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

token refresh offset #12136

Merged
merged 33 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
updates
  • Loading branch information
xiangyan99 committed Jul 17, 2020
commit 04dad9d08381da923a676d96cf69a538b20aee1b
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_cached_token(self, scopes):
tokens = self._cache.find(TokenCache.CredentialType.ACCESS_TOKEN, target=list(scopes))
for token in tokens:
expires_on = int(token["expires_on"])
if expires_on - self._token_refresh_retry_delay > int(time.time()):
if expires_on > int(time.time()):
return AccessToken(token["secret"], expires_on)
return None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_cached_access_token(self, scopes, query=None):
tokens = self._cache.find(TokenCache.CredentialType.ACCESS_TOKEN, target=list(scopes), query=query)
for token in tokens:
expires_on = int(token["expires_on"])
if expires_on - self._token_refresh_retry_delay > int(time.time()):
if expires_on > int(time.time()):
return AccessToken(token["secret"], expires_on)
return None

Expand Down