Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(cron): clean persistence lint issues
Xubin Ren9a9e446f3fb2
diff --git a/nanobot/cron/service.py b/nanobot/cron/service.pyindex c3ccd08a6..e5428c114 100644--- a/nanobot/cron/service.py+++ b/nanobot/cron/service.py@@ -14,7 +14,14 @@ from typing import Any, Callable, Coroutine, Literalfrom filelock import FileLockfrom loguru import logger-from nanobot.cron.types import CronJob, CronJobState, CronPayload, CronRunRecord, CronSchedule, CronStore+from nanobot.cron.types import (+ CronJob,+ CronJobState,+ CronPayload,+ CronRunRecord,+ CronSchedule,+ CronStore,+)def _now_ms() -> int:@@ -387,11 +394,10 @@ class CronService:async def _on_timer(self) -> None:"""Handle timer tick - run due jobs."""- loaded = self._load_store()- # If a hot reload found a corrupt store on disk, ``loaded`` is- # ``None`` but ``self._store`` may still hold the previous,- # known-good in-memory snapshot. Keep using it rather than- # crashing the timer or wiping live jobs.+ self._load_store()+ # If a hot reload found a corrupt store on disk, ``self._store`` may+ # still hold the previous, known-good in-memory snapshot. Keep using+ # it rather than crashing the timer or wiping live jobs.if not self._store:self._arm_timer()returndiff --git a/tests/cron/test_cron_persistence.py b/tests/cron/test_cron_persistence.pyindex fb218687e..4732f61e0 100644--- a/tests/cron/test_cron_persistence.py+++ b/tests/cron/test_cron_persistence.py@@ -9,7 +9,6 @@ jobs.json + don't silently overwrite corrupt store``.from __future__ import annotationsimport json-import timefrom pathlib import Pathimport pytest