auth: request refresh tokens with expiry <3 minutes.

Due to swarming, 5 minutes is hard upper limit,
and by the time token arrives to the bot it may be <5 minutes,
like here
https://logs.chromium.org/v/?s=chromium%2Fbuildbucket%2Fcr-buildbucket.appspot.com%2F8947432403218547136%2F%2B%2Fsteps%2Fpresubmit%2F0%2Fstdout

R=vadimsh@chromium.org

Bug: 837087
Change-Id: I98fbe3f0f85c9f62bc984f439614c3f88a16ed06
Reviewed-on: https://chromium-review.googlesource.com/1044779
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
changes/79/1044779/2
Andrii Shyshkalov 7 years ago committed by Commit Bot
parent 1575912136
commit 142a92ce8b

@ -81,8 +81,8 @@ class AccessToken(collections.namedtuple('AccessToken', [
"""True if this AccessToken should be refreshed."""
if self.expires_at is not None:
now = now or datetime.datetime.utcnow()
# Allow 5 min of clock skew between client and backend.
now += datetime.timedelta(seconds=300)
# Allow 3 min of clock skew between client and backend.
now += datetime.timedelta(seconds=180)
return now >= self.expires_at
# Token without expiration time never expires.
return False

Loading…
Cancel
Save