bug: fix a bug where whatsminers could raise a cascading TimeoutError.
This commit is contained in:
@@ -215,14 +215,18 @@ If you are sure you want to use this command please use API.send_command("{comma
|
|||||||
return b"{}"
|
return b"{}"
|
||||||
|
|
||||||
# send the command
|
# send the command
|
||||||
data_task = asyncio.create_task(self._read_bytes(reader, timeout=timeout))
|
try:
|
||||||
logging.debug(f"{self} - ([Hidden] Send Bytes) - Writing")
|
data_task = asyncio.create_task(self._read_bytes(reader, timeout=timeout))
|
||||||
writer.write(data)
|
logging.debug(f"{self} - ([Hidden] Send Bytes) - Writing")
|
||||||
logging.debug(f"{self} - ([Hidden] Send Bytes) - Draining")
|
writer.write(data)
|
||||||
await writer.drain()
|
logging.debug(f"{self} - ([Hidden] Send Bytes) - Draining")
|
||||||
|
await writer.drain()
|
||||||
|
|
||||||
await data_task
|
await data_task
|
||||||
ret_data = data_task.result()
|
ret_data = data_task.result()
|
||||||
|
except TimeoutError:
|
||||||
|
logging.warning(f"{self} - ([Hidden] Send Bytes) - Read timeout expired.")
|
||||||
|
return b"{}"
|
||||||
|
|
||||||
# close the connection
|
# close the connection
|
||||||
logging.debug(f"{self} - ([Hidden] Send Bytes) - Closing")
|
logging.debug(f"{self} - ([Hidden] Send Bytes) - Closing")
|
||||||
|
|||||||
Reference in New Issue
Block a user