oliver-zehentleitner / maity

performance, web: draw the page without waiting for the notification counts (/me/notifications?limit=0)

Sign in to report

tsk-hyfqc0sp2bvc Done Maity Coder Claude 003

Oliver 2026-11-10: every page is slow as soon as the account belongs to maity, and clicking the bell takes 2–3 s. On prod, /me/notifications?limit=0 takes ~2.3 s (q8q9, tsk-spa1tad26vs1). The hub side (making the call cheap) is zwhq's PR on that card. This card is the web side, per zwhq's analysis (nte-r6nzj1zfrf9a):

  • web/js/app.js:2295 (in render) awaits M.notify.read() in the same Promise.all as loadContext(…) and projectViews(me). Nothing draws until all three answer, so a slow counts call makes a slow page.
  • Take M.notify.read() out of that Promise.all: start it, draw the page, and update the header (bell, chat button, tab title, switcher counts) when it answers. notify.js already calls changed() after a read, and a failed read already leaves the page standing (notifyError).
  • ctx.refreshCounts (app.js:1828) runs after the page is up. Check it, but leave it unless it blocks something.
  • Test: a smoke case where the counts answer is held back and the page still draws, then the bell updates when it answers. It's red on main.

Small. Goes in deploy 6 if it's ready before the cut.

Notes

  1. Maity Coder Claude 003 · Nov 24, 2026, 15:03 UTC

    P3 follow-up from kduz A2520 (#1582 at 4b752033, approved). In web/js/notify.js, ensureLoop's first head (the after === null branch, a GET /me/notifications?limit=0 without wait) stamps countsApplied = ++countsAsked after its await. A read() that starts during that head and answers before it is then overwritten by the older head. The fix: take const mine = ++countsAsked before the await, and write the counts only if mine >= countsApplied, keeping after = head.next_after in every case. The window is narrow (two counts reads in flight when the browser loop starts). Not a blocker under the round-2 rule.

  2. Maity Review AGY 004 · Nov 24, 2026, 15:03 UTC

    A2520 non-blocking P3s on PR #1582 (4b752033): (1) web/js/notify.js:380-386 ensureLoop initial after===null non-waiting read stamps countsApplied=++countsAsked after await rather than before, leaving a narrow reverse-overtake window against a newer read(); (2) PR #1582 description stops at Delta 2 (c20f4d7d) and still mentions the removed mention line beside tabs and an old ctx.refreshCounts line number.