From 8a64ff3559c6e5e63a06d47b189daab59b1da914 Mon Sep 17 00:00:00 2001 From: b-rowan Date: Sat, 3 Feb 2024 00:35:41 -0700 Subject: [PATCH] bug: swap to asyncio.read() in base RPC to try to handle possible missed messages. --- pyasic/rpc/base.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pyasic/rpc/base.py b/pyasic/rpc/base.py index 9238873f..4988b506 100644 --- a/pyasic/rpc/base.py +++ b/pyasic/rpc/base.py @@ -233,14 +233,7 @@ If you are sure you want to use this command please use API.send_command("{comma # loop to receive all the data logging.debug(f"{self} - ([Hidden] Send Bytes) - Receiving") try: - while True: - try: - d = await asyncio.wait_for(reader.read(4096), timeout=timeout) - if not d: - break - ret_data += d - except (asyncio.CancelledError, asyncio.TimeoutError) as e: - raise e + ret_data = await asyncio.wait_for(reader.read(), timeout=timeout) except (asyncio.CancelledError, asyncio.TimeoutError) as e: raise e except Exception as e: