Only save previous state if it's known
This commit is contained in:
@@ -135,9 +135,10 @@ async def monitor_state_transitions(app):
|
||||
try:
|
||||
await asyncio.sleep(5)
|
||||
current_state = get_derived_state()
|
||||
if current_state != "unknown" and current_state != PREVIOUS_STATE:
|
||||
logging.info(f"State transitioned from '{PREVIOUS_STATE}' to '{current_state}'.")
|
||||
PREVIOUS_STATE = current_state
|
||||
if current_state != "unknown":
|
||||
if current_state != PREVIOUS_STATE:
|
||||
logging.info(f"State transitioned from '{PREVIOUS_STATE}' to '{current_state}'.")
|
||||
PREVIOUS_STATE = current_state
|
||||
except asyncio.CancelledError:
|
||||
logging.info("State transition monitoring task cancelled.")
|
||||
break
|
||||
|
Reference in New Issue
Block a user