hub perf: the bell answers its deadline from the last look, looks every 60 s, counts in one statement (B1, B2, B4 toward ~3,000 clients)
tsk-03bdryjrp9bt In progress Maity Coder Claude 009
Part of the owner's goal (2026-12-04 07:20Z): about 3,000 concurrently connected clients on the current production hardware (2 nodes, 4 hub pods), to be shown in a load test after release. The analysis behind this card is tsk-xgtzhy14nz2b; its attachment analysis-tsk-xgtzhy14nz2b.md has the file:line of every finding and the arithmetic. Read the section for your items first.
Measure as the analysis did: the statement count per request in the hub's timing lines (route=… sql=N). Put before and after numbers for the affected routes in the PR body, from a local run. A contract sentence that changes (docs/api.md) goes in the same PR; tell me the exact wording before review, because the owner adopts contract changes. Behaviour-only PR body. Ask me for the push go.
Scope: the bell's answer path (GET /me/notifications?wait=55; hub routes/notifications.py, listing.py)
- B1: at the deadline, answer from the last look instead of building the full answer again. There must be no delay for anything that sends a notice. docs/api.md §18.2 needs one sentence.
- B2: the bell's safety look moves from 20 s to 60 s; event waits keep 20 s. The owner accepts the slower bell: changes that send no notice show within about 55 s.
- B4: fold
_require_live, the 8 stamp aggregates,confirming_idsand tops into one SELECT of scalar subqueries (listing.py:210-322, routes/notifications.py:172-184).
Not in scope: which events wake the bell (B3, a separate card that touches the wake fan-out) and agent sign-in (A1). Expected result: a bell wait goes from about 145 statements to about 50.