api: implement automatic mqtt reconnect in ccujack cron
All checks were successful
Build Container / Build Container (push) Successful in 1m27s
All checks were successful
Build Container / Build Container (push) Successful in 1m27s
This commit is contained in:
parent
319670b6ae
commit
6bbfc5dc68
2 changed files with 12 additions and 1 deletions
|
|
@ -162,9 +162,12 @@ class CCUJackClient:
|
|||
while True:
|
||||
try:
|
||||
|
||||
await asyncio.sleep(60 * 60) # 1 hour
|
||||
await asyncio.sleep(15 * 60) # 15 minutes
|
||||
logger.info("Running CCUJack cron")
|
||||
await self.find_locks()
|
||||
if not self.mqtt.is_connected():
|
||||
logger.warning("MQTT client was discovered to be disconnected; reconnecting now")
|
||||
await self.mqtt.connect()
|
||||
|
||||
except Exception as e:
|
||||
logger.exception(f"Error in CCUJack cron task: {e}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue