Implement adaptive stale period for auth tokens#1482
Open
mihaimitrea-db wants to merge 5 commits intomainfrom
Open
Implement adaptive stale period for auth tokens#1482mihaimitrea-db wants to merge 5 commits intomainfrom
mihaimitrea-db wants to merge 5 commits intomainfrom
Conversation
Compute stale period dynamically as min(TTL × 0.5, 20 minutes) instead of using a fixed 5-minute value. This ensures tokens with shorter lifetimes e.g., FastPath's 10-minute TTL) refresh appropriately without triggering premature expirations, while standard OAuth tokens continue using the 20-minute stale period for robustness.
…-driven test Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Extract the repeated staleDuration update pattern into a cachedTokenSource method (updateStaleDuration), placed alongside tokenState() where both token-freshness concerns live together. Add a withTimeNow test option to inject a fixed clock at construction time, so updateStaleDuration() is deterministic from the first call. This removes the post-construction Expiry/timeNow overrides and the tolerance-based assertDurationNear helper, replacing all stale-duration assertions with exact equality checks. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> Signed-off-by: Mihai Mitrea <[email protected]>
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement dynamic token stale period for improved auth reliability
Extends the token refresh buffer from a fixed 5 minutes to a dynamic period that adapts to token lifetime, improving reliability across different token types while maintaining backward compatibility.
Changes:
Implementation:
Token behavior examples:
Testing: