Repository navigation
Use a unique caller reference for each invalidation - #17
Merged
bencroker merged 1 commit intoOct 22, 2026
Merged
Conversation
`time()` repeats within a second, so CloudFront rejects a second invalidation sent in the same second. A UUID makes each `CallerReference` unique.
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.
sendRequest()setsCallerReferencetotime(), which repeats within a second. When two invalidations are sent in the same second, for example a refresh job andblitz/cache/purge, CloudFront rejects the second one and its paths are never invalidated:If the paths match, CloudFront instead returns the earlier invalidation and creates no new one, so that purge silently does nothing.
This uses
StringHelper::UUID()so every request gets a uniqueCallerReference. The AWS SDK retries a request with the same parameters, so a retried request keeps its reference and stays idempotent.This removes an accidental throttle: identical purges sent in the same second used to collapse into one invalidation, and now each one is sent. The throttle never worked as one, since it drops any batch whose paths differ, and its window is a fixed clock second. If throttling is wanted, it fits better in Blitz than in the purger. Blitz already merges a request's refresh data into one
RefreshCacheJobat the end of the request.RefreshCacheService::refresh()could also push that job with a short delay and merge refresh data across requests, so saves close together send one invalidation with every path.