bug: fix a bug with connection errors rarely being raised on read in API commands.

This commit is contained in:
UpstreamData
2023-05-12 10:46:43 -06:00
parent f1c4cb400a
commit 83a4f86e15

View File

@@ -182,7 +182,10 @@ If you are sure you want to use this command please use API.send_command("{comma
writer.write(data)
logging.debug(f"{self} - ([Hidden] Send Bytes) - Draining")
await writer.drain()
ret_data = await asyncio.wait_for(reader.read(4096), timeout=timeout)
try:
ret_data = await asyncio.wait_for(reader.read(4096), timeout=timeout)
except ConnectionAbortedError:
return b"{}"
try:
# Fix for stupid whatsminer bug, reboot/restart seem to not load properly in the loop
# have to receive, save the data, check if there is more data by reading with a short timeout