Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions async_substrate_interface/async_substrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def __init__(
self._received: dict[str, asyncio.Future] = {}
self._received_subscriptions: dict[str, asyncio.Queue] = {}
self._sending: Optional[asyncio.Queue] = None
self._send_recv_task = None
self._send_recv_task: Optional[asyncio.Task] = None
self._inflight: dict[str, str] = {}
self._attempts = 0
self._lock = asyncio.Lock()
Expand Down Expand Up @@ -747,7 +747,7 @@ async def _start_receiving(self, ws: ClientConnection) -> Exception:
elif isinstance(e, websockets.exceptions.ConnectionClosedOK):
logger.debug("Websocket connection closed.")
else:
logger.debug(f"Timeout occurred. Reconnecting.")
logger.debug(f"Timeout occurred.")
return e

async def _start_sending(self, ws) -> Exception:
Expand Down Expand Up @@ -780,7 +780,7 @@ async def _start_sending(self, ws) -> Exception:
elif isinstance(e, websockets.exceptions.ConnectionClosedOK):
logger.debug("Websocket connection closed.")
else:
logger.debug("Timeout occurred. Reconnecting.")
logger.debug("Timeout occurred.")
return e

async def send(self, payload: dict) -> str:
Expand Down Expand Up @@ -859,6 +859,9 @@ async def retrieve(self, item_id: str) -> Optional[dict]:
if isinstance((e := self._send_recv_task.exception()), Exception):
logger.exception(f"Websocket sending exception: {e}")
raise e
elif isinstance((e := self._send_recv_task.result()), Exception):
logger.exception(f"Websocket sending exception: {e}")
raise e
await asyncio.sleep(0.1)
return None

Expand Down
Loading