Skip to content

Your lightweight open-source personal agent.

fix(cron): clean persistence lint issues

Xubin Ren9a9e446f3fb2
diff --git a/nanobot/cron/service.py b/nanobot/cron/service.py
index c3ccd08a6..e5428c114 100644
--- a/nanobot/cron/service.py
+++ b/nanobot/cron/service.py
@@ -14,7 +14,14 @@ from typing import Any, Callable, Coroutine, Literal
from filelock import FileLock
from 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()
return
diff --git a/tests/cron/test_cron_persistence.py b/tests/cron/test_cron_persistence.py
index 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 annotations
import json
-import time
from pathlib import Path
import pytest