Repository navigation
Send the weekly email before warming the page caches - #136
Merged
Merged
Conversation
The store poller started the three page warmers the moment the rebuild finished and only then built and sent the email. The warmers are CPU-bound Python in the same process, so the email a subscriber is waiting for queued behind GIL contention with cache fills for pages nobody had opened yet. Now the send goes first and the warmers start after it, outside the try so a failed send still warms the pages. The rebuild itself was the larger cost and is fixed in cotmetrics 0.14.2 (per-row index loops made rolling, ~100s -> ~12s locally). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
The store poller started the three page warmers as soon as the rebuild finished, and only then built and sent the weekly email. The warmers are CPU-bound Python in the same process, so the email competed with them for the GIL while they filled caches for pages nobody had opened yet.
What
The send now goes first, and the warmers start after it. They start outside the
try, so a failed send still warms the pages. Nothing else changes: the email still waits forrefresh_if_stale(), so it still builds from the new week rather than a mix.The larger cost was the rebuild itself. That is fixed in cotmetrics 0.14.2: the per-row index loops are now rolling, ~100s -> ~12s locally, with identical output. cot-analyzer installs cotmetrics editable from the sibling checkout, so the server needs both checkouts updated.
Tests: 882 passed against both branches (shadowed via
PYTHONPATH,__file__checked).ruff check src testsclean.🤖 Generated with Claude Code