Skip to content

DirsHKDistnPeople: keep today's distribution for the day, warm it (WEBBSITE-47) - #132

Merged
gfrmin merged 1 commit into
masterfrom
triage/steel-legend-20261125-030155
Nov 25, 2026
Merged

gfrmin merged 1 commit into
masterfrom
triage/steel-legend-20261125-030155

Conversation

@gfrmin

@gfrmin gfrmin commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Sentry: WEBBSITE-47 (statement timeout, dbpub_statistics.dirs_hk_distn_people, 1 event 2026-11-25T01:00Z, default URL with no d).

Cause. Not the box: in 00:55–01:05Z every other route's DB spans were under 220 ms p95. The route's 30-day DB p50 is ~330 ms, and the production plan (scripts/pgq.py --explain) is sound: 520 ms, ~155k shared-buffer hits, nested-loop index scans over directorships/people. Cold, those hits become random reads and the query crossed the 8 s default. Same pattern as WEBBSITE-46 (FDirsPerListcoHKdstn).

Fix. Today's distribution (the default view) goes through _today_or_live, so it is computed once per data version and day, and the page is added to webbsite/warm.py so a deploy rewarms it. Other dates stay live. Rows are copied before the cumulative columns are added so the cached result is not mutated.

Evidence. New check in tests/test_sentry_regressions.py (item 18): a repeat request for today's page makes no queries. Before the fix: DirsHKDistnPeople today: a repeat is served from the cache: got [None], want []. After: the CI DB-free unit list passes, 198 passed; ruff clean; test_render_parity.py unchanged.

🤖 Generated with Claude Code

WEBBSITE-47: the default (today) view of the directorships-per-person
distribution ran its whole-market query on every request; ~0.5 s with a
warm buffer cache (production plan: ~155k shared-buffer hits, plan sound),
it hit the 8 s statement timeout once when cold, while every other route
in the same minutes was under 220 ms. Today's result is now precomputed
per data version and day (_today_or_live, as FDirsPerListcoHKdstn does
since WEBBSITE-46) and in the warm list; other dates stay live.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gfrmin gfrmin added the sentry-triage opened by the Sentry triage agent label Nov 25, 2026
@gfrmin
gfrmin merged commit 1bf4ab7 into master Nov 25, 2026
6 checks passed
@gfrmin
gfrmin deleted the triage/steel-legend-20261125-030155 branch November 25, 2026 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sentry-triage opened by the Sentry triage agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant