Skip to content

fix(domains): cancel retries using a threading event#1253

Merged
roflcoopter merged 1 commit intodevfrom
feature/cancel-retry-event
Feb 15, 2026
Merged

fix(domains): cancel retries using a threading event#1253
roflcoopter merged 1 commit intodevfrom
feature/cancel-retry-event

Conversation

@roflcoopter
Copy link
Owner

This improves the shutdown and future reload handling by instantly cancel retries using a threading.Event

Copilot AI review requested due to automatic review settings February 15, 2026 21:13
@netlify
Copy link

netlify bot commented Feb 15, 2026

Deploy Preview for viseron canceled.

Name Link
🔨 Latest commit 85e4b66
🔍 Latest deploy log https://app.netlify.com/projects/viseron/deploys/699236f42741a60008d8e347

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_event field to DomainEntry for per-domain retry cancellation
  • Replaced polling-based retry wait loops with event-based wait using cancel_event.wait(timeout)
  • Removed global reloading_event in favor of per-domain cancellation events
  • Refactored shutdown signal handling in __main__.py to 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.

@roflcoopter roflcoopter merged commit 83ba965 into dev Feb 15, 2026
24 checks passed
@roflcoopter roflcoopter deleted the feature/cancel-retry-event branch February 15, 2026 21:21
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

Comments