bug: handle edge cases where a missed get_config on bosminer can cause an empty config to be applied to a miner.
This commit is contained in:
@@ -303,17 +303,12 @@ class BOSMiner(BaseMiner):
|
|||||||
The config from `self.config`.
|
The config from `self.config`.
|
||||||
"""
|
"""
|
||||||
logging.debug(f"{self}: Getting config.")
|
logging.debug(f"{self}: Getting config.")
|
||||||
conn = None
|
|
||||||
try:
|
try:
|
||||||
conn = await self._get_ssh_connection()
|
conn = await self._get_ssh_connection()
|
||||||
except ConnectionError:
|
except ConnectionError:
|
||||||
try:
|
conn = None
|
||||||
pools = await self.api.pools()
|
|
||||||
except APIError:
|
|
||||||
return self.config
|
|
||||||
if pools:
|
|
||||||
self.config = MinerConfig().from_api(pools["POOLS"])
|
|
||||||
return self.config
|
|
||||||
if conn:
|
if conn:
|
||||||
async with conn:
|
async with conn:
|
||||||
# good ol' BBB compatibility :/
|
# good ol' BBB compatibility :/
|
||||||
@@ -365,6 +360,8 @@ class BOSMiner(BaseMiner):
|
|||||||
async def set_power_limit(self, wattage: int) -> bool:
|
async def set_power_limit(self, wattage: int) -> bool:
|
||||||
try:
|
try:
|
||||||
cfg = await self.get_config()
|
cfg = await self.get_config()
|
||||||
|
if cfg is None:
|
||||||
|
return False
|
||||||
cfg.autotuning_wattage = wattage
|
cfg.autotuning_wattage = wattage
|
||||||
await self.send_config(cfg)
|
await self.send_config(cfg)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user