Skip to content

perf: eliminate 5 redundant health checks on startup — data in <1 second#423

Merged
rygel merged 1 commit intodevelopfrom
perf/startup-optimization
Mar 22, 2026
Merged

perf: eliminate 5 redundant health checks on startup — data in <1 second#423
rygel merged 1 commit intodevelopfrom
perf/startup-optimization

Conversation

@rygel
Copy link
Copy Markdown
Owner

@rygel rygel commented Mar 22, 2026

Summary

Startup went from 7 sequential HTTP calls to 2. Data appears in <1 second when Monitor is already running.

Before: RefreshPort → CheckHealth → EnsureAgentRunning (file+health+process) → UpdateToggle (file+health+process) → CheckContract (health) → RapidPoll CheckHealth → RapidPoll GetUsage

After: RefreshPort → FetchData. If no data: start monitor, fetch again. Contract check runs in background.

Deleted 128 lines: RapidPollUntilDataAvailableAsync, UpdateMonitorToggleButtonStateAsync, dead else block.

Test plan

  • Build succeeds
  • Manual: restart UI with Monitor running — data appears in <1s
  • Manual: start UI with Monitor stopped — monitor starts, data appears after boot
  • CI checks pass

🤖 Generated with Claude Code

Before: 5 health checks + file reads + process checks before showing data
  1. Orchestrator: RefreshPort (file read)
  2. Orchestrator: CheckHealth (HTTP)
  3. EnsureAgentRunning: GetReadyState (file + HTTP + process)
  4. UpdateMonitorToggleButtonStateAsync (file + HTTP + process)
  5. CheckApiContractAsync (HTTP)
  6. RapidPoll: CheckHealth (HTTP)
  7. RapidPoll: GetUsageAsync (HTTP — first actual data fetch)

After: 1 port refresh + 1 data fetch, monitor start only if needed
  1. RefreshPort (file read)
  2. FetchDataAsync (HTTP — data appears immediately)
  3. If no data: start monitor, fetch again
  4. Contract check in background (non-blocking)

Deleted: RapidPollUntilDataAvailableAsync (128 lines),
UpdateMonitorToggleButtonStateAsync, orphaned else block.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rygel rygel merged commit 47ed573 into develop Mar 22, 2026
15 of 16 checks passed
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.

2 participants