Skip to content

Commit c6af1d6

Browse files
authored
feat: Modify the token refresh window (#1419)
Set the token refresh window from 30s to 3 minutes and 45 seconds.
1 parent 6c610a5 commit c6af1d6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

google/auth/_helpers.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@
2323

2424
from google.auth import exceptions
2525

26-
# Token server doesn't provide a new a token when doing refresh unless the
27-
# token is expiring within 30 seconds, so refresh threshold should not be
28-
# more than 30 seconds. Otherwise auth lib will send tons of refresh requests
29-
# until 30 seconds before the expiration, and cause a spike of CPU usage.
30-
REFRESH_THRESHOLD = datetime.timedelta(seconds=20)
26+
# The smallest MDS cache used by this library stores tokens until 4 minutes from
27+
# expiry.
28+
REFRESH_THRESHOLD = datetime.timedelta(minutes=3, seconds=45)
3129

3230

3331
def copy_docstring(source_class):

0 commit comments

Comments
 (0)