Skip to content

FDirsPerListcoHKdstn: keep today's distribution for the day, warm it (WEBBSITE-46) - #130

Merged
gfrmin merged 1 commit into
masterfrom
triage/steel-legend-20261113-150308
Nov 13, 2026
Merged

gfrmin merged 1 commit into
masterfrom
triage/steel-legend-20261113-150308

Conversation

@gfrmin

@gfrmin gfrmin commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Sentry: WEBBSITE-46 (dbpub_statistics.fdirsperlistcohkdstn, statement timeout, 1 event at 2026-11-13T00:15Z, no query string, so today's date).

Cause. The route ran its whole-market query (listed companies, then directorships and people) on every request with no caching. The production plan is fine: 366 ms, all shared-buffer hits (scripts/pgq.py --explain). The route's db span p50 is 183 ms and p95 347 ms over 30 days. Other routes were fast at 00:15 (http.server p95 under 240 ms for every transaction in 00:05–00:25), and no other span ran over 3 s, so it was not load. The query reads about 135k buffers (directorships plus a people lookup per director), and with a cold cache that is enough to pass 8 s.

Fix. This is the sibling pages' pattern (boardcomp, HKdirsTypeSex): today's result is precomputed per data version and day with _today_or_live, and /dbpub/FDirsPerListcoHKdstn.asp is in the warm list, so the cold run happens in the warmer and not on a visitor's request. Other dates stay live. I did not add a timeout_s override, because test_perf_budget caps the number of overrides and the plan does not need one. The output is unchanged: test_render_parity passes.

Evidence.

  • Red: on the unfixed route, the new check in tests/test_sentry_regressions.py failed with FDirsPerListcoHKdstn today: a repeat is served from the cache: got [None, None], want [], meaning both queries ran again on the repeat request.
  • Green: ruff check . is clean, and CI's DB-free pytest list gives 198 passed.

🤖 Generated with Claude Code

WEBBSITE-46: the default (today) view of the female-director distribution
ran its whole-market query on every request; ~0.4 s with a warm buffer
cache, it hit the 8 s statement timeout once when cold, while other
routes were fast. Today's result is now precomputed per data version
and day (_today_or_live, as boardcomp/HKdirsTypeSex do) 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 13, 2026
@gfrmin
gfrmin merged commit a913bd3 into master Nov 13, 2026
6 checks passed
@gfrmin
gfrmin deleted the triage/steel-legend-20261113-150308 branch November 13, 2026 13:12
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