fixed a bug with miner factory not handling ConnectionRefused errors properly

This commit is contained in:
UpstreamData
2022-07-19 16:16:36 -06:00
parent 3ec833e700
commit b120064e80
2 changed files with 4 additions and 4 deletions

View File

@@ -126,7 +126,7 @@ If you are sure you want to use this command please use API.send_command("{comma
except APIError as e:
raise APIError(e)
except Exception as e:
logging.warning(f"{self.ip}: API Multicommand Error: {e.__name__} - {e}")
logging.warning(f"{self.ip}: API Multicommand Error: {e}")
return data
async def send_command(
@@ -176,7 +176,7 @@ If you are sure you want to use this command please use API.send_command("{comma
break
data += d
except Exception as e:
logging.warning(f"{self.ip}: API Command Error: {e.__name__} - {e}")
logging.warning(f"{self.ip}: API Command Error: - {e}")
data = self._load_api_data(data)

View File

@@ -408,7 +408,7 @@ class MinerFactory(metaclass=Singleton):
# catch APIError and let the factory know we cant get data
logging.warning(f"{ip}: API Command Error: {e}")
return None, None, None
except OSError as e:
except OSError or ConnectionRefusedError:
# miner refused connection on API port, we wont be able to get data this way
# try ssh
try:
@@ -572,7 +572,7 @@ class MinerFactory(metaclass=Singleton):
# get reader and writer streams
reader, writer = await asyncio.open_connection(str(ip), 4028)
except OSError as e:
if e.errno in [10061, 22] or e.winerror == 1225:
if e.errno in [10061, 22]:
raise e
logging.warning(f"{str(ip)} - Command {command}: {e}")
return {}