-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: improve check for validity of token #76
Merged
Merged
Conversation
This file contains 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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #76 +/- ##
============================================
+ Coverage 28.51% 28.65% +0.13%
- Complexity 721 723 +2
============================================
Files 145 145
Lines 5277 5283 +6
Branches 567 567
============================================
+ Hits 1505 1514 +9
+ Misses 3714 3712 -2
+ Partials 58 57 -1 ☔ View full report in Codecov by Sentry. |
ewanharris
changed the title
test: extend tests for access token validity check
fix: improve check for validity of token
Apr 26, 2024
ewanharris
force-pushed
the
fix/refactor-validity-check
branch
2 times, most recently
from
April 26, 2024 14:11
4676fa4
to
a0ce129
Compare
ewanharris
force-pushed
the
fix/refactor-validity-check
branch
from
April 26, 2024 14:12
a0ce129
to
c34968c
Compare
rhamzeh
reviewed
Apr 26, 2024
rhamzeh
reviewed
Apr 26, 2024
rhamzeh
reviewed
Apr 26, 2024
rhamzeh
reviewed
Apr 26, 2024
rhamzeh
reviewed
Apr 26, 2024
4 tasks
rhamzeh
approved these changes
Apr 26, 2024
This was referenced Apr 30, 2024
Merged
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.
Description
I've removed the jitter here as I'm not sure what it added and it made testing harder as we didn't have predictability. If we want to guard against a potential "thundering herd" on the token refresh then I think we'd be better off attempting to only allow one call to the token endpoints to occur at a time (not sure how to do this in Java myself, maybe if we used synchronized onexchangeToken
?The jitter calculation has been changed to use
nextInt(TOKEN_EXPIRY_BUFFER_THRESHOLD_IN_SEC)
, this will return a value up to our 300 seconds limit that we can use to prevent multiple calls at the same time. From my testingnextLong
could potentially return negative values so I believe this is not safe to use, given we want our jitter to be up to 300 seconds more then wenextInt
with the bound is safer.References
Resolves #75
Review Checklist
main