From 76dd98f9092660c0cb0cb9df52c2de7e684df063 Mon Sep 17 00:00:00 2001 From: UpstreamData Date: Fri, 5 Nov 2021 08:43:26 -0600 Subject: [PATCH] fixed a bug with timeouts on get version --- config_tool.py | 2 +- miners/miner_factory.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config_tool.py b/config_tool.py index 8b87e1ca..2c61afe9 100644 --- a/config_tool.py +++ b/config_tool.py @@ -1,4 +1,4 @@ from cfg_util import main if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/miners/miner_factory.py b/miners/miner_factory.py index 1701560c..85adb6a4 100644 --- a/miners/miner_factory.py +++ b/miners/miner_factory.py @@ -43,7 +43,10 @@ class MinerFactory: # open a connection to the miner fut = asyncio.open_connection(str(ip), 4028) # get reader and writer streams - reader, writer = await asyncio.wait_for(fut, timeout=5) + try: + reader, writer = await asyncio.wait_for(fut, timeout=7) + except asyncio.exceptions.TimeoutError: + return None # create the command cmd = {"command": "version"} @@ -68,7 +71,10 @@ class MinerFactory: # some stupid whatsminers need a different command fut = asyncio.open_connection(str(ip), 4028) # get reader and writer streams - reader, writer = await asyncio.wait_for(fut, timeout=5) + try: + reader, writer = await asyncio.wait_for(fut, timeout=7) + except asyncio.exceptions.TimeoutError: + return None # create the command cmd = {"command": "get_version"}