Skip to content

Send the weekly email before warming the page caches - #136

Merged
mspinola merged 1 commit into
mainfrom
claude/cot-data-update-performance-81f15e
Sep 25, 2026
Merged

mspinola merged 1 commit into
mainfrom
claude/cot-data-update-performance-81f15e

Conversation

@mspinola

Copy link
Copy Markdown
Owner

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 for refresh_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 tests clean.

🤖 Generated with Claude Code

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>
@mspinola
mspinola merged commit 37ef789 into main Sep 25, 2026
3 checks passed
@mspinola
mspinola deleted the claude/cot-data-update-performance-81f15e branch September 25, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant