feat: auto-restart browser on crash with watchdog (#14)#22
Open
hayka-pacha wants to merge 1 commit into
Open
Conversation
- Add watchdog task to BrowserManager that periodically checks if running
profiles are still alive by probing context.pages
- If a profile crashes, automatically restart it with exponential backoff
(1s, 2s, 4s, max 30s) and max 3 retries before giving up
- Add auto_restart boolean field to profile model (default True)
- Add auto_restart to database schema with migration for existing DBs
- Start watchdog in lifespan startup in main.py
- Explicitly stopped profiles are tracked to prevent unwanted restarts
- cleanup_all() cancels watchdog task on shutdown
- Fix lambda closure bug in context.on('close') callback
- Add 12 tests: crash detection, restart, backoff, max retries, healthy
profiles, auto_restart disabled, user-stopped profiles, deleted profiles
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.
What
Adds a background watchdog that detects crashed browser instances and automatically restarts them, closing #14.
Changes
Test results
All 204 tests pass (192 existing + 12 new).
Design notes