From 14f193313bb0f4914b8978289a5f6c5e82c4bee4 Mon Sep 17 00:00:00 2001 From: tiansy888 Date: Mon, 27 Jul 2026 10:32:03 +0800 Subject: [PATCH] fix: preserve exception chain in wait_dispatched timeout Chain the original asyncio.TimeoutError via 'raise ... from exc' so __cause__ is retained, making flaky relay timeouts easier to debug. Fixes #167 --- coworker/connectors/relay_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coworker/connectors/relay_client.py b/coworker/connectors/relay_client.py index 57fc38cc..f1e7bf1c 100644 --- a/coworker/connectors/relay_client.py +++ b/coworker/connectors/relay_client.py @@ -204,10 +204,10 @@ async def wait_dispatched(self, at_least: int, timeout: float = 2.0) -> None: ) try: await asyncio.wait_for(self._progress.wait(), timeout=remaining) - except asyncio.TimeoutError: + except asyncio.TimeoutError as exc: raise TimeoutError( f"only {self._dispatched} frames dispatched (< {at_least})" - ) + ) from exc # -- default transport --------------------------------------------------- def _default_transport_factory(self) -> RelayTransport: