fixed a bug with timeouts on get version

This commit is contained in:
UpstreamData
2021-11-05 08:43:26 -06:00
parent 4a733dd80a
commit 76dd98f909
2 changed files with 9 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
from cfg_util import main from cfg_util import main
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@@ -43,7 +43,10 @@ class MinerFactory:
# open a connection to the miner # open a connection to the miner
fut = asyncio.open_connection(str(ip), 4028) fut = asyncio.open_connection(str(ip), 4028)
# get reader and writer streams # 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 # create the command
cmd = {"command": "version"} cmd = {"command": "version"}
@@ -68,7 +71,10 @@ class MinerFactory:
# some stupid whatsminers need a different command # some stupid whatsminers need a different command
fut = asyncio.open_connection(str(ip), 4028) fut = asyncio.open_connection(str(ip), 4028)
# get reader and writer streams # 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 # create the command
cmd = {"command": "get_version"} cmd = {"command": "get_version"}