feat(ads-client): respect server max-age in cache TTL resolution#7344
Open
Almaju wants to merge 2 commits intomozilla:mainfrom
Open
feat(ads-client): respect server max-age in cache TTL resolution#7344Almaju wants to merge 2 commits intomozilla:mainfrom
Almaju wants to merge 2 commits intomozilla:mainfrom
Conversation
copyrighthero
requested changes
May 5, 2026
Resolve effective TTL by priority via a new EffectiveTtl helper — explicit per-request TTL wins, otherwise the response's Cache-Control: max-age is used, otherwise the configured default_ttl. Previously the layer took the min of all three, which collapsed to the short default_ttl in practice and ignored the server's max-age signal. AC-103
Apply a 7-day ceiling to the resolved effective TTL regardless of source. Without it, a misconfigured server max-age (e.g. years) or an oversized caller/default value would persist responses far longer than is reasonable for this cache. AC-103
fc40827 to
df8cc99
Compare
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.
Resolve effective TTL by priority — explicit per-request TTL wins, otherwise the response's Cache-Control: max-age is used, otherwise the configured default_ttl. Result is capped at 7 days for safety.
Previously the layer took the min of all three, which collapsed to the short default_ttl in practice and ignored the server's max-age signal.
AC-103
Pull Request checklist
[ci full]to the PR title.