From 65589311fb291245fbf026b88db641a6b4b0449f Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Mon, 7 Oct 2024 20:43:05 +0200 Subject: [PATCH] Fixes receiving task cancellation (does not try to await if not started) --- bittensor_cli/src/bittensor/async_substrate_interface.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bittensor_cli/src/bittensor/async_substrate_interface.py b/bittensor_cli/src/bittensor/async_substrate_interface.py index c953d02f5..0268a39a2 100644 --- a/bittensor_cli/src/bittensor/async_substrate_interface.py +++ b/bittensor_cli/src/bittensor/async_substrate_interface.py @@ -681,11 +681,8 @@ async def shutdown(self): async with self._lock: try: self._receiving_task.cancel() - except AttributeError: - pass - try: await self._receiving_task - except asyncio.CancelledError: + except (AttributeError, asyncio.CancelledError): pass await self.ws.close() self.ws = None