From 186464bf5920fb3b76499ac542b0fb90023629de Mon Sep 17 00:00:00 2001 From: Carl Lundin <108372512+clundin25@users.noreply.github.com> Date: Mon, 26 Sep 2022 23:07:38 +0000 Subject: [PATCH] Revert "fix: Update token refresh threshold from 20 seconds to 5 minutes (#1146)" (#1153) This reverts commit 261a56138fba33ff7d898ab5907a6098125fefef. --- google/auth/_helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/google/auth/_helpers.py b/google/auth/_helpers.py index c70fd6a6b..1b08ab87f 100644 --- a/google/auth/_helpers.py +++ b/google/auth/_helpers.py @@ -23,7 +23,11 @@ from six.moves import urllib -REFRESH_THRESHOLD = datetime.timedelta(seconds=300) +# 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):