Repository navigation
perf: eliminate polling storm + parallelize mounts + cache context-stats (#269) - #270
Merged
Merged
Conversation
…ats (#269) Frontend was making 64+ API requests/minute from duplicate polling, sequential mount waterfalls, and no background-tab awareness. Backend was fan-out HTTP calling every agent container every 5 seconds without caching. Key changes: - Deduplicate polling: agents.js stats removed, networkStore is single owner - Reduce frequencies: context 5s→15s, agent refresh 10s→30s - Skip polling when tab backgrounded (document.hidden checks) - Parallelize mount calls with Promise.allSettled() (Dashboard, AgentDetail, Agents) - Replace 100ms router setTimeout with proper auth init promise - Add GET request deduplication in api.js - Backend: 15s TTL cache on context-stats, invalidated on agent start/stop - Backend: filter context-stats fan-out to running agents only - Guard all composable polling against double-registration - Stagger cleanup service startup by 2.5s from operator queue Expected: 64+ req/min → ~8 req/min, page loads 60-70% faster. Closes #269 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
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.
Summary
Changes
Frontend (13 files)
stores/agents.js— Remove duplicate polling; stats now single-sourced from networkStorestores/network.js— Context polling 5s→15s, agent refresh 10s→30s,document.hiddenchecksstores/auth.js— AddwaitForInit()promise for router guardrouter/index.js— Replace 100mssetTimeoutwithauthStore.waitForInit()api.js— GET request deduplication (in-flight map)views/Dashboard.vue—Promise.allSettled()for 6 mount callsviews/AgentDetail.vue—Promise.allSettled()for 12 mount callsviews/Agents.vue— Switch to networkStore for stats; parallelize mountcomposables/useAgentStats.js— Double-registration guard + visibility checkcomposables/useSessionActivity.js— Double-registration guard + visibility checkcomposables/useGitSync.js— Double-registration guard + visibility checkstores/alerts.js,stores/notifications.js— Visibility-aware pollingBackend (4 files)
services/agent_service/stats.py— 15s TTL cache, filter to running agents onlyrouters/agents.py— Cache invalidation on agent start/stopmain.py— Stagger cleanup service startup by 2.5sTest Plan
Closes #269
🤖 Generated with Claude Code