feat(controller): make token cache ttl more dynamic#5684
Open
krancour wants to merge 1 commit intoakuity:mainfrom
Open
feat(controller): make token cache ttl more dynamic#5684krancour wants to merge 1 commit intoakuity:mainfrom
krancour wants to merge 1 commit intoakuity:mainfrom
Conversation
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
✅ Deploy Preview for docs-kargo-io ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
2 tasks
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5684 +/- ##
==========================================
+ Coverage 56.15% 56.24% +0.09%
==========================================
Files 448 448
Lines 37656 37759 +103
==========================================
+ Hits 21145 21239 +94
- Misses 15253 15263 +10
+ Partials 1258 1257 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
hiddeco
reviewed
Feb 2, 2026
| // Cache the encoded token, preferring a TTL derived from the actual token | ||
| // expiry when available. | ||
| ttl := cache.DefaultExpiration | ||
| if !expiry.IsZero() { |
Contributor
There was a problem hiding this comment.
We are doing this in multiple places, probably better to extract it to a helper:
func CalculateCacheTTL(expiry time.Time, margin time.Duration) time.Duration {}
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.
Supersedes #5615
In many cases, though not all, we have access to a token's expiry date/time.
For such cases, it is safer to derive cache TTL durations from the expiry than to make assumptions about how long the token is valid for.
This also adds debug level logging with details of token expiry (if known) and corresponding cache entry TTL.