Skip to content

fix: harden event sends on shutdown, debounce connection-triggered re-elections - #2231

Open
caesarniseko-coder wants to merge 1 commit into
exo-explore:mainfrom
caesarniseko-coder:shutdown-hardening
Open

fix: harden event sends on shutdown, debounce connection-triggered re-elections#2231
caesarniseko-coder wants to merge 1 commit into
exo-explore:mainfrom
caesarniseko-coder:shutdown-hardening

Conversation

@caesarniseko-coder

Copy link
Copy Markdown

Summary

  • Shutdown hardening: event sends in DownloadCoordinator and Worker._forward_info now tolerate closed/broken channels instead of crashing, so components exit cleanly during shutdown
  • Re-election resilience: apply() skips out-of-order indexed events with a warning instead of asserting, so replayed events after a master re-election no longer crash the node
  • Topology correctness: thunderbolt bridge cycles are recomputed when network interfaces or thunderbolt connections change, not only when bridge status changes
  • Election debounce: after a connection-triggered campaign, further connection messages are absorbed for 25s and coalesced into at most one follow-up round. This stops topology-formation bursts from causing perpetual re-elections, while never dropping a master-disconnect (a follow-up round runs if anything arrived) and never delaying shutdown (a closed channel ends the wait immediately)

Test plan

  • uv run pytest — full suite green (370 passed); election tests 14/14, suite runtime dropped from ~52s to ~2s since shutdown no longer stalls
  • uv run basedpyright — 0 errors
  • uv run ruff check — clean
  • Manual: node boots, API responds, SIGINT shuts down cleanly with no errors logged

🤖 Generated with Claude Code

…-elections

- Tolerate closed event channels when emitting download progress and
  gathered info, so components exit cleanly during shutdown
- Skip out-of-order indexed events instead of asserting, so replays
  after re-election don't crash the node
- Recompute thunderbolt bridge cycles on network-interface and
  thunderbolt-connection updates
- Debounce connection-triggered elections: absorb the topology-formation
  burst for 25s and coalesce it into at most one follow-up round,
  without delaying shutdown or dropping master-disconnect events

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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