Repository navigation
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The dashboard's
dashboard/analyticsrequest kept timing out against the background daemon.Root cause (measured on a real 839k-event database)
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.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:taskpolicy -c utility: 109–1,520 msProcessType: Interactive: 50–99 msCommit 2 sets
ProcessType: Interactivein 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.tsandsrc/storage.test.tspass.src/ipc.test.ts > reads and toggles codex and claude routingfails 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