Repository navigation
Conversation
mroderick
force-pushed
the
fix/chapters-sidebar-derived-cache-key
branch
from
October 7, 2026 19:31
6996c97 to
5ee4012
Compare
mroderick
marked this pull request as ready for review
October 7, 2026 19:52
The sidebar fragment was cached under a fixed key while the Chapter callbacks deleted a different key, so the homepage kept rendering deactivated chapters for any write path, including direct database updates. Cache the fragment under a versioned key with a 10-minute TTL instead: every write path shows up within the TTL, and a warm cache hit runs no chapter query. Fixes codebar#2993
mroderick
force-pushed
the
fix/chapters-sidebar-derived-cache-key
branch
from
October 7, 2026 20:14
5ee4012 to
422f380
Compare
This branch has not been deployed
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.
Problem: the homepage chapter list kept deactivated chapters. The sidebar fragment is cached under
views/chapters_sidebar_component/chapters-sidebar, whileChapter#expire_chapters_sidebar_cachedeletedchapters-sidebar. The delete never matched, so no write path invalidated the fragment, and production served one stale entry from 13 September to 7 October. Fixes #2993.Changes:
expires_in: 10.minutes, the shape used by the events/past fragment. Every write path, including direct database updates, shows up within the TTL. Thev2tag keeps the key clear of the stale production entry.chaptersrelation stays lazy and the cache block never enumerates it on a hit. The request spec pins this with a zero-query assertion.Chaptercache-expiry callbacks and their model specs; the TTL replaces them.Post-deploy: no cache purge needed, and chapter changes appear within 10 minutes.