fix(menubar): drop prefetchAll to keep Today label fresh

The detached prefetch spawned four codeburn subprocesses (week, 30days,
month, all) that competed with the main refresh loop's Today fetch for
disk and parser time. On large session corpora that starved the Today
refresh for minutes at a time, and the status label drifted stale until
the prefetch queue finally drained. Users perceived this as the menubar
"stopping" until they clicked a provider tab, which coincided with the
queue clearing.

Drop prefetchAll. Period tabs in the popover now fetch lazily on first
click (3-10 seconds once per app lifetime per period), same as they did
in 0.8.1. Today's label stays fresh because nothing else is hammering
the parser in the background.
This commit is contained in:
iamtoruk 2026-04-21 07:36:00 -07:00
parent cdfda9507c
commit eb0d096c62
2 changed files with 6 additions and 17 deletions

View file

@ -88,14 +88,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate {
}
}
// Prefetch the remaining periods in a detached task. This used to be awaited inside the
// refresh loop, but on large corpora the All Time / Month period can take 60+ seconds to
// parse and blocked Today's refresh for that whole window, so the status label drifted
// out of sync with the CLI until prefetchAll finally returned.
Task { @MainActor [weak self] in
guard let s = self else { return }
await s.store.prefetchAll()
}
// Period tabs are fetched lazily when the user first clicks them in the popover.
// An earlier version prefetched every period on launch to make tab switching instant,
// but on large session corpora that spawned four concurrent codeburn subprocesses
// competing with the main refresh loop for disk and parser time, and the status label
// drifted stale for minutes. A per-tab first-click cost of a few seconds is the better
// tradeoff on user machines that track thousands of sessions.
}
private func observeStore() {