ignore errors with S19 multicommands
This commit is contained in:
@@ -59,7 +59,9 @@ class BaseMinerAPI:
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
async def multicommand(self, *commands: str) -> dict:
|
async def multicommand(
|
||||||
|
self, *commands: str, ignore_x19_error: bool = False
|
||||||
|
) -> dict:
|
||||||
"""Creates and sends multiple commands as one command to the miner."""
|
"""Creates and sends multiple commands as one command to the miner."""
|
||||||
logging.debug(f"{self.ip}: Sending multicommand: {[*commands]}")
|
logging.debug(f"{self.ip}: Sending multicommand: {[*commands]}")
|
||||||
# split the commands into a proper list
|
# split the commands into a proper list
|
||||||
@@ -78,7 +80,7 @@ If you are sure you want to use this command please use API.send_command("{item}
|
|||||||
command = "+".join(commands)
|
command = "+".join(commands)
|
||||||
data = None
|
data = None
|
||||||
try:
|
try:
|
||||||
data = await self.send_command(command)
|
data = await self.send_command(command, x19_command=ignore_x19_error)
|
||||||
except APIError:
|
except APIError:
|
||||||
try:
|
try:
|
||||||
data = {}
|
data = {}
|
||||||
@@ -99,6 +101,7 @@ If you are sure you want to use this command please use API.send_command("{item}
|
|||||||
command: str,
|
command: str,
|
||||||
parameters: str or int or bool = None,
|
parameters: str or int or bool = None,
|
||||||
ignore_errors: bool = False,
|
ignore_errors: bool = False,
|
||||||
|
x19_command: bool = False,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
"""Send an API command to the miner and return the result."""
|
"""Send an API command to the miner and return the result."""
|
||||||
try:
|
try:
|
||||||
@@ -143,7 +146,8 @@ If you are sure you want to use this command please use API.send_command("{item}
|
|||||||
# validate the command succeeded
|
# validate the command succeeded
|
||||||
validation = self.validate_command_output(data)
|
validation = self.validate_command_output(data)
|
||||||
if not validation[0]:
|
if not validation[0]:
|
||||||
logging.warning(f"{self.ip}: API Command Error: {validation[1]}")
|
if not x19_command:
|
||||||
|
logging.warning(f"{self.ip}: API Command Error: {validation[1]}")
|
||||||
raise APIError(validation[1])
|
raise APIError(validation[1])
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|||||||
@@ -144,7 +144,9 @@ class BMMiner(BaseMiner):
|
|||||||
|
|
||||||
miner_data = None
|
miner_data = None
|
||||||
for i in range(DATA_RETRIES):
|
for i in range(DATA_RETRIES):
|
||||||
miner_data = await self.api.multicommand("summary", "pools", "stats")
|
miner_data = await self.api.multicommand(
|
||||||
|
"summary", "pools", "stats", ignore_x19_error=True
|
||||||
|
)
|
||||||
if miner_data:
|
if miner_data:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user