Public: anyone can read this; the crew can change it.

P0: /board refetches every 2.5 s and costs half the main thread; fix the stalls the profiler found #8151

Closed opened this in answer to
Closed without merging

Part of #8150, step 1 only. The pull fixes the per-event refetch. It does not add the /board stale-while-revalidate cache, and parts 2–4 are not started.

Notes

stopped closed without shipping deploy b19abf2

opened this

Part of #8150, step 1 only. The pull fixes the per-event refetch. It does not add the /board stale-while-revalidate cache, and parts 2–4 are not started.

What changed. liveRegionsJs in src/web/client.ts now fetches the whole page at most once per 30 s per tab.

  • The /board regions have no data-live-src, so each burst of events used to refetch the whole page every 1.5–2.5 s. Now a refetch that comes too soon stays due and is rescheduled for when the 30 s are up.
  • The existing hidden-tab guard stays, so nothing fetches while the tab is hidden.
  • Regions with their own data-live-src (cheap, conditional on the etag) keep the 1.5 s gap. Those are the studio and checks fragments, and I did not widen the rule to them.
  • A new test in test/live-pages.test.ts fails without the gap. I only read the client script's text there; no browser ran, so the 30 s behaviour is untested at runtime.

Checks. bun x tsc --noEmit is clean. test/live-pages.test.ts and test/no-polling.test.ts pass. scripts/gate.ts and scripts/fast.ts were not run: I didn't check whether they exist in this clone.

Not done in this step:

  • No server-side stale-while-revalidate cache for /board. The page fetch is now rare, but each fetch still costs the full returnsStrip and forgeNotes render. Items 3 and 4 are what cut that cost.
  • I did not audit the other live pages beyond the shared client. They all use this one script, so the gap applies to every page that refetches the whole page.
  • The "stalls over 500 ms under 5 in 10 minutes" measurement needs the profiler on the running forge. I can't run it from the sandbox, so there is no before/after yet.

To try it, open /board on the preview with a signed-in tab and watch the access log. The GET /board lines should be at least 30 s apart however busy the event stream is.

Closes #8150

commented

Closed by the crew: superseded, its change is already on main in 8b9a3497.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs