Skip to content

Reduce content-script watchdog polling cost#217

Merged
bartekplus merged 2 commits intomasterfrom
codex/watchdog-event-driven-refresh
Feb 24, 2026
Merged

Reduce content-script watchdog polling cost#217
bartekplus merged 2 commits intomasterfrom
codex/watchdog-event-driven-refresh

Conversation

@bartekplus
Copy link
Owner

@bartekplus bartekplus commented Feb 24, 2026

Summary

  • replace unconditional 1s watchdog polling in content scripts
  • schedule watchdog checks only on relevant events (navigation, lifecycle, focus, visibility, and root DOM changes)
  • debounce event bursts by 250ms to avoid repeated checks
  • keep existing hostname and DOM-root recovery behavior

Why

  • content scripts run in all frames, so interval polling created steady background work in every frame, including idle/disabled contexts

Testing

  • npm run build
  • npm test -- tests/content_script.watchdog.test.ts
  • npm test

@bartekplus bartekplus merged commit dd91ee4 into master Feb 24, 2026
4 checks passed
@bartekplus bartekplus deleted the codex/watchdog-event-driven-refresh branch February 24, 2026 17:24
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