fix: append 'unknown' to history on timeout or client error
Co-authored-by: aider (gemini/gemini-2.5-pro-preview-05-06) <aider@aider.chat>
This commit is contained in:
@@ -105,8 +105,14 @@ async def monitor_garage_door(app):
|
||||
|
||||
except asyncio.TimeoutError:
|
||||
logging.warning("Request to camera timed out.")
|
||||
PREDICTION_HISTORY.append('unknown')
|
||||
if len(PREDICTION_HISTORY) > PREDICTION_HISTORY_MAX_LENGTH:
|
||||
PREDICTION_HISTORY.pop(0)
|
||||
except aiohttp.ClientError as e:
|
||||
logging.error(f"Client error during image fetch: {e}")
|
||||
PREDICTION_HISTORY.append('unknown')
|
||||
if len(PREDICTION_HISTORY) > PREDICTION_HISTORY_MAX_LENGTH:
|
||||
PREDICTION_HISTORY.pop(0)
|
||||
except asyncio.CancelledError:
|
||||
logging.info("Monitoring task cancelled.")
|
||||
break
|
||||
|
Reference in New Issue
Block a user