Skip to content

perf(app): spawn concurrency cap, background prefetch, Today default#748

Merged
iamtoruk merged 1 commit into
mainfrom
fix/app-spawn-storm
Jul 18, 2026
Merged

perf(app): spawn concurrency cap, background prefetch, Today default#748
iamtoruk merged 1 commit into
mainfrom
fix/app-spawn-storm

Conversation

@iamtoruk

Copy link
Copy Markdown
Member

App half of the desktop-slowness fix (root-caused on a data-heavy machine: each CLI spawn costs 1.5-4s there, and the app multiplied that by spawning without limit).

  • Spawn concurrency cap (2) with two priority classes in app/electron/cli.ts: interactive (user-visible polls, Settings mutations) always dequeues before background; cache/coalesce hits never take a slot; per-call timeout starts at real spawn, not while queued; killAll also settles queued waiters so quit can't hang.
  • Prefetch loop tamed: provider warms are background-priority (add-only IPC arg, older preload degrades gracefully), stagger raised 400ms → 2000ms so the loop is genuinely paced, and warms hold while a user fetch is in flight instead of racing it. No whole-set re-warm on period change (session-lifetime warmedKeys guard kept).
  • Default period is now Today (was Last 30 Days) when no Settings preference is saved — a saved preference still wins. Also the cheapest period to compute.

Tests: app suite 409 passed (6 new: scheduler cap/preemption/coalesce/cancel, IPC priority plumbing, default-period); typecheck + electron build clean.

@iamtoruk
iamtoruk merged commit 8892553 into main Jul 18, 2026
3 checks passed
@iamtoruk
iamtoruk deleted the fix/app-spawn-storm branch July 18, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant