Skip to content

fix(desktop): backoff on errors to stop CPU abuse + shrink settings window#633

Merged
koala73 merged 1 commit into
mainfrom
fix/cpu-abuse-backoff-settings-height
Mar 1, 2026
Merged

fix(desktop): backoff on errors to stop CPU abuse + shrink settings window#633
koala73 merged 1 commit into
mainfrom
fix/cpu-abuse-backoff-settings-height

Conversation

@koala73

@koala73 koala73 commented Mar 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • RefreshScheduler (line 88): error handler was resetting currentMultiplier = 1 (fastest), now backs off with currentMultiplier * 2 — matches the unchanged-data path
  • classify-event batch: 401 auth failures now pause the batch for 120s instead of silently resolving null and continuing every 2s
  • Fetch patch 401 retry: after a token-refresh + retry still returns 401, suppress further retries for 60s (prevents doubling every request)
  • Settings window: 760→600px height, min 620→480px

Context

Desktop app burns 130% CPU when sidecar auth fails. Log shows 358 401s + 23 503s in 3.5 min — every request doubled by the 401 retry, scheduler polling at max rate because errors reset backoff, classify-event firing every 2s without stopping.

Test plan

  • Verify web app still refreshes data on normal intervals (RefreshScheduler change only affects error path)
  • Desktop: confirm CPU usage drops significantly when auth is broken
  • Settings window: check all tabs fit without excessive whitespace

…indow

Three bugs combine to burn 130% CPU when sidecar auth fails:

1. RefreshScheduler resets backoff multiplier to 1 (fastest) on error,
   causing failed endpoints to poll at base interval instead of backing off.
   Fix: exponential backoff on errors, same as unchanged-data path.

2. classify-event batch system ignores 401 (auth failure) — only pauses
   on 429/5xx. Hundreds of classify calls fire every 2s, each wasted.
   Fix: pause 120s on 401, matching the 429/5xx pattern.

3. Fetch patch retries every 401 (refresh token + retry), doubling all
   requests to the sidecar even when token refresh consistently fails.
   Fix: 60s cooldown after a retry-401 still returns 401.

Also shrinks settings window from 760→600px (min 620→480) to reduce
the empty whitespace below content on all tabs.
@vercel

vercel Bot commented Mar 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
worldmonitor Building Building Preview, Comment Mar 1, 2026 6:29am
worldmonitor-finance Building Building Preview, Comment Mar 1, 2026 6:29am
worldmonitor-happy Building Building Preview, Comment Mar 1, 2026 6:29am
worldmonitor-startup Building Building Preview, Comment Mar 1, 2026 6:29am

Request Review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@koala73
koala73 merged commit 9266a6c into main Mar 1, 2026
6 checks passed
koala73 added a commit that referenced this pull request Mar 1, 2026
…indow (#633)

Three bugs combine to burn 130% CPU when sidecar auth fails:

1. RefreshScheduler resets backoff multiplier to 1 (fastest) on error,
   causing failed endpoints to poll at base interval instead of backing off.
   Fix: exponential backoff on errors, same as unchanged-data path.

2. classify-event batch system ignores 401 (auth failure) — only pauses
   on 429/5xx. Hundreds of classify calls fire every 2s, each wasted.
   Fix: pause 120s on 401, matching the 429/5xx pattern.

3. Fetch patch retries every 401 (refresh token + retry), doubling all
   requests to the sidecar even when token refresh consistently fails.
   Fix: 60s cooldown after a retry-401 still returns 401.

Also shrinks settings window from 760→600px (min 620→480) to reduce
the empty whitespace below content on all tabs.
matthewvecchione1-ops pushed a commit to matthewvecchione1-ops/worldmonitor that referenced this pull request Mar 4, 2026
…indow (koala73#633)

Three bugs combine to burn 130% CPU when sidecar auth fails:

1. RefreshScheduler resets backoff multiplier to 1 (fastest) on error,
   causing failed endpoints to poll at base interval instead of backing off.
   Fix: exponential backoff on errors, same as unchanged-data path.

2. classify-event batch system ignores 401 (auth failure) — only pauses
   on 429/5xx. Hundreds of classify calls fire every 2s, each wasted.
   Fix: pause 120s on 401, matching the 429/5xx pattern.

3. Fetch patch retries every 401 (refresh token + retry), doubling all
   requests to the sidecar even when token refresh consistently fails.
   Fix: 60s cooldown after a retry-401 still returns 401.

Also shrinks settings window from 760→600px (min 620→480) to reduce
the empty whitespace below content on all tabs.
@koala73
koala73 deleted the fix/cpu-abuse-backoff-settings-height branch March 4, 2026 19:40
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