← back to Exo
cancel active downloads on coordinator shutdown (#1567)
10930802145e50aae3a0c445930c81b20fded7a8 · 2026-02-20 17:17:43 +0000 · Evan Quiney
we were seeing some crashes as lost download tasks were trying to push
data toward a deleted coordinator. this cancels download tasks with the
coordinator's shutdown on master election
Files touched
M src/exo/download/coordinator.py
Diff
commit 10930802145e50aae3a0c445930c81b20fded7a8
Author: Evan Quiney <evanev7@gmail.com>
Date: Fri Feb 20 17:17:43 2026 +0000
cancel active downloads on coordinator shutdown (#1567)
we were seeing some crashes as lost download tasks were trying to push
data toward a deleted coordinator. this cancels download tasks with the
coordinator's shutdown on master election
---
src/exo/download/coordinator.py | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/exo/download/coordinator.py b/src/exo/download/coordinator.py
index 0aa2374a..dc1c71c8 100644
--- a/src/exo/download/coordinator.py
+++ b/src/exo/download/coordinator.py
@@ -124,14 +124,18 @@ class DownloadCoordinator:
)
if not self.offline:
self._test_internet_connection()
- async with self._tg as tg:
- tg.start_soon(self._command_processor)
- tg.start_soon(self._forward_events)
- tg.start_soon(self._emit_existing_download_progress)
- tg.start_soon(self._resend_out_for_delivery)
- tg.start_soon(self._clear_ofd)
- if not self.offline:
- tg.start_soon(self._check_internet_connection)
+ try:
+ async with self._tg as tg:
+ tg.start_soon(self._command_processor)
+ tg.start_soon(self._forward_events)
+ tg.start_soon(self._emit_existing_download_progress)
+ tg.start_soon(self._resend_out_for_delivery)
+ tg.start_soon(self._clear_ofd)
+ if not self.offline:
+ tg.start_soon(self._check_internet_connection)
+ finally:
+ for task in self.active_downloads.values():
+ task.cancel()
def _test_internet_connection(self) -> None:
# Try multiple endpoints since some ISPs/networks block specific IPs
← 1a2b8b04 Refactor runner into separate runners (#1570)
·
back to Exo
·
Update mlx fork (#1565) e01f50a5 →