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): auto-reload jobs.json when modified externally
Re-bin89e5a28097bf
diff --git a/nanobot/cron/service.py b/nanobot/cron/service.pyindex 6889a1060..7c7b3e5c2 100644--- a/nanobot/cron/service.py+++ b/nanobot/cron/service.py@@ -68,13 +68,19 @@ class CronService:on_job: Callable[[CronJob], Coroutine[Any, Any, str | None]] | None = None):self.store_path = store_path- self.on_job = on_job # Callback to execute job, returns response text+ self.on_job = on_jobself._store: CronStore | None = None+ self._last_mtime: float = 0.0self._timer_task: asyncio.Task | None = Noneself._running = Falsedef _load_store(self) -> CronStore:- """Load jobs from disk."""+ """Load jobs from disk. Reloads automatically if file was modified externally."""+ if self._store and self.store_path.exists():+ mtime = self.store_path.stat().st_mtime+ if mtime != self._last_mtime:+ logger.info("Cron: jobs.json modified externally, reloading")+ self._store = Noneif self._store:return self._store@@ -163,6 +169,7 @@ class CronService:}self.store_path.write_text(json.dumps(data, indent=2, ensure_ascii=False), encoding="utf-8")+ self._last_mtime = self.store_path.stat().st_mtimeasync def start(self) -> None:"""Start the cron service."""