Skip to content

Commit

Permalink
feat: Modify the refresh window to match go/async-token-refresh. Serv…
Browse files Browse the repository at this point in the history
…erless tokens are cached until 4 minutes before expiration, so 4 minutes is the ideal refresh window. (#1352)

* feat: Modify the refresh window to match go/async-token-refresh. Serverless tokens are cached until 4 minutes before expiration, so 4 minutes is the ideal refresh window.
* Tweak time to 3 minutes and 45 seconds, giving the MDS a 15 second window to refresh.
* Update both expiration margin and refresh margin.
  • Loading branch information
clundin25 authored Jan 11, 2024
1 parent 5226e76 commit a7a8d7a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
public class OAuth2Credentials extends Credentials {

private static final long serialVersionUID = 4556936364828217687L;
static final Duration DEFAULT_EXPIRATION_MARGIN = Duration.ofMinutes(5);
static final Duration DEFAULT_REFRESH_MARGIN = Duration.ofMinutes(6);
static final Duration DEFAULT_EXPIRATION_MARGIN = Duration.ofMinutes(3);
static final Duration DEFAULT_REFRESH_MARGIN = Duration.ofMinutes(3).plusSeconds(45);
private static final ImmutableMap<String, List<String>> EMPTY_EXTRA_HEADERS = ImmutableMap.of();

@VisibleForTesting private final Duration expirationMargin;
Expand Down

0 comments on commit a7a8d7a

Please sign in to comment.