fixed a bug with miner factory not handling ConnectionRefused errors properly
This commit is contained in:
@@ -126,7 +126,7 @@ If you are sure you want to use this command please use API.send_command("{comma
|
|||||||
except APIError as e:
|
except APIError as e:
|
||||||
raise APIError(e)
|
raise APIError(e)
|
||||||
except Exception as 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
|
return data
|
||||||
|
|
||||||
async def send_command(
|
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
|
break
|
||||||
data += d
|
data += d
|
||||||
except Exception as e:
|
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)
|
data = self._load_api_data(data)
|
||||||
|
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ class MinerFactory(metaclass=Singleton):
|
|||||||
# catch APIError and let the factory know we cant get data
|
# catch APIError and let the factory know we cant get data
|
||||||
logging.warning(f"{ip}: API Command Error: {e}")
|
logging.warning(f"{ip}: API Command Error: {e}")
|
||||||
return None, None, None
|
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
|
# miner refused connection on API port, we wont be able to get data this way
|
||||||
# try ssh
|
# try ssh
|
||||||
try:
|
try:
|
||||||
@@ -572,7 +572,7 @@ class MinerFactory(metaclass=Singleton):
|
|||||||
# get reader and writer streams
|
# get reader and writer streams
|
||||||
reader, writer = await asyncio.open_connection(str(ip), 4028)
|
reader, writer = await asyncio.open_connection(str(ip), 4028)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
if e.errno in [10061, 22] or e.winerror == 1225:
|
if e.errno in [10061, 22]:
|
||||||
raise e
|
raise e
|
||||||
logging.warning(f"{str(ip)} - Command {command}: {e}")
|
logging.warning(f"{str(ip)} - Command {command}: {e}")
|
||||||
return {}
|
return {}
|
||||||
|
|||||||
Reference in New Issue
Block a user