Skip to content

dashboard stops timing out: per-minute analytics rollup + interactive daemon priority - #41

Open
sleithart wants to merge 2 commits into
RubricLab:mainfrom
sleithart:analytics-minute-rollup
Open

sleithart wants to merge 2 commits into
RubricLab:mainfrom
sleithart:analytics-minute-rollup

Conversation

@sleithart

Copy link
Copy Markdown

Why

The dashboard's dashboard/analytics request kept timing out against the background daemon.

Root cause (measured on a real 839k-event database)

  1. Analytics scanned every raw token event. Old storage took ~800 ms per analytics call on the daemon's only thread. Commit 1 adds a per-minute rollup table (token_minutes) for charts whose buckets are 10 min or wider: ~45 ms.

  2. launchd ran the daemon at utility QoS. The LaunchAgent plist has no ProcessType, so macOS ran the daemon at priority 20 on efficiency cores. Same build, same data:

    • normal priority: 50–68 ms per analytics call
    • taskpolicy -c utility: 109–1,520 ms
    • login daemon before fix: 470–4,870 ms
    • login daemon with ProcessType: Interactive: 50–99 ms

    Commit 2 sets ProcessType: Interactive in the generated plist.

Note for existing installs

The plist is only rewritten by tokenmaxx daemon install. Existing users need to run that once after updating to get the priority fix.

Tests

  • bun test src/launch-agent.test.ts and src/storage.test.ts pass.
  • src/ipc.test.ts > reads and toggles codex and claude routing fails on this machine with and without these commits (it reads the real Grok routing state, xai=true). Pre-existing; not touched here.

🤖 Generated with Claude Code

sleithart and others added 2 commits October 28, 2026 12:38
…ing the daemon

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… timing out

launchd ran the daemon at utility QoS without a ProcessType. On a
real 839k-event database each dashboard/analytics call took 0.1-4.9s
under utility QoS and 50-90ms at normal priority.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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