aboutsummaryrefslogtreecommitdiff
path: root/google/auth/_helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'google/auth/_helpers.py')
-rw-r--r--google/auth/_helpers.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/google/auth/_helpers.py b/google/auth/_helpers.py
index 11c6b1a..55adf5b 100644
--- a/google/auth/_helpers.py
+++ b/google/auth/_helpers.py
@@ -20,8 +20,11 @@ import datetime
import urllib
-CLOCK_SKEW_SECS = 60 # 60 seconds
-CLOCK_SKEW = datetime.timedelta(seconds=CLOCK_SKEW_SECS)
+# Token server doesn't provide a new a token when doing refresh unless the
+# token is expiring within 30 seconds, so refresh threshold should not be
+# more than 30 seconds. Otherwise auth lib will send tons of refresh requests
+# until 30 seconds before the expiration, and cause a spike of CPU usage.
+REFRESH_THRESHOLD = datetime.timedelta(seconds=20)
def copy_docstring(source_class):