Repository navigation
Cache 404s, bust when documents become public [staging] - #505
Merged
Merged
Conversation
Exclude the scratch field from AddOnEvents from event lists and expanded run events, which was causing memory issues
Prepares for caching anonymous 404s: every path that makes a document
visible to anonymous users now purges its `doc-{id}` tag.
- update_access: purge on the final chunk, when access actually changes
(also covers scheduled publishing)
- processing completion, set_page_text and modifications post_process:
purge when the document is public, not only when cache_dirty is set
- admin: purge on every save, since admin can change access directly
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Anonymous GETs of a document that isn't visible (private, processing,
deleted or missing) now return a 404 the CDN can hold briefly, tagged
`doc-{id}` so the purges from the previous commit clear it.
- DocumentViewSet retrieve and NoteViewSet list send
`public, max-age=0, s-maxage=CACHE_CONTROL_NOT_FOUND_MAX_AGE`
- new setting CACHE_CONTROL_NOT_FOUND_MAX_AGE (default 300, 0 disables)
- authenticated 404s and malformed ids keep their current headers
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
|
Is this on staging? I'd like to test |
Contributor
Author
|
Now it's on staging. |
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.
We now cache document URLs in the API for five minutes (configurable with
CACHE_CONTROL_NOT_FOUND_MAX_AGE). This covers the frontend, too, since we pass through cache headers now.We generate a cache tag in the view, so 404s cache but get busted when we purge a document's tag.
This handles a couple cases:
When a private document becomes public, we now purge the cache at the end of that process, so we don't get a stale cache.