fix(domains): cancel retries using a threading event#1253
Merged
roflcoopter merged 1 commit intodevfrom Feb 15, 2026
Merged
Conversation
✅ Deploy Preview for viseron canceled.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request enhances the domain retry cancellation mechanism by introducing per-domain cancel_event (threading.Event) to enable instant cancellation of retry loops during shutdown or domain reload operations. The previous approach used a global reloading_event and polled shutdown/reload states in tight loops, which has been replaced with event-based cancellation that wakes up blocking waits immediately.
Changes:
- Added
cancel_eventfield toDomainEntryfor per-domain retry cancellation - Replaced polling-based retry wait loops with event-based wait using
cancel_event.wait(timeout) - Removed global
reloading_eventin favor of per-domain cancellation events - Refactored shutdown signal handling in
__main__.pyto use a daemon thread instead of nested Timer
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| viseron/domain_registry.py | Added cancel_event field to DomainEntry and implemented cancel_retry() and cancel_all_retries() methods |
| viseron/domains/init.py | Replaced polling-based retry wait with cancel_event.wait(), added cancel_retry call in unload_domain, improved state management to keep RETRYING visible during retry attempts |
| viseron/init.py | Removed global reloading_event, added cancel_all_retries() call in shutdown, changed thread filtering from "setup_domains" to "MainThread" |
| viseron/main.py | Refactored signal handler to start shutdown on daemon thread, improved shutdown flow with proper thread joining and timeout handling |
| viseron/config.py | Removed unused variable assignment that was immediately overridden |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This improves the shutdown and future reload handling by instantly cancel retries using a threading.Event