-
Notifications
You must be signed in to change notification settings - Fork 41
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
bugfix: refresh before token expires, not after #254
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
joan38
approved these changes
Nov 15, 2023
|
Done 👍 |
Oh interesting 🤔 It indeed looks like a val shouldRenew = cached.expirationTimestamp.exists(_.isBefore(now.minusSeconds(refreshBeforeExpiration.toSeconds)))
~~~~~~~~ it should be like this (with
|
yurique
reviewed
Nov 15, 2023
kubernetes-client/test/src/com/goyeau/kubernetes/client/cache/AuthorizationCacheTest.scala
Outdated
Show resolved
Hide resolved
yurique
approved these changes
Nov 15, 2023
joan38
requested changes
Nov 17, 2023
kubernetes-client/src/com/goyeau/kubernetes/client/util/cache/AuthorizationCache.scala
Outdated
Show resolved
Hide resolved
Sorry I got waylaid, feel free to push whatever you need to my branch to
sort it out.
…On Fri, 24 Nov 2023, 5:28 pm Joan Goyeau, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
kubernetes-client/src/com/goyeau/kubernetes/client/util/cache/AuthorizationCache.scala
<#254 (comment)>
:
> @@ -38,8 +38,8 @@ object AuthorizationCache {
case Some(cached) =>
F.realTimeInstant
.flatMap { now =>
- val shouldRenew =
- cached.expirationTimestamp.exists(_.isBefore(now.minusSeconds(refreshBeforeExpiration.toSeconds)))
+ val minExpiry = now.plusSeconds(refreshBeforeExpiration.toSeconds)
We need: https://github.com/scala/scala-java8-compat
ivy"org.scala-lang.modules::scala-java8-compat:1.0.2"
—
Reply to this email directly, view it on GitHub
<#254 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAADOXCO67BLUGMO24IWNSTYGA5ANAVCNFSM6AAAAAA7MA6FT6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTONBXGM3TCNRSGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
joan38
approved these changes
Nov 24, 2023
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.
If you set
refreshBeforeExpiration
to 1 minute, the current code refreshes the token only after the token has expired for at least a minute. Time maths are hard, I had to add the test to actually verify my hunch 😆