Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix(cron): Fixed an issue where cron jobs were triggered 5 minutes early

openJiuwen-botc435f7b89e50
diff --git a/jiuwenswarm/gateway/cron/scheduler.py b/jiuwenswarm/gateway/cron/scheduler.py
index 5bb92a15cd..c5bd1d5c9b 100644
--- a/jiuwenswarm/gateway/cron/scheduler.py
+++ b/jiuwenswarm/gateway/cron/scheduler.py
@@ -724,8 +724,11 @@ class CronSchedulerService:
run_id,
len(state.result_text or ""),
)
+ push_dt = datetime.fromisoformat(state.push_at_iso)
+ now_dt = datetime.fromtimestamp(self._now_fn(), tz=ZoneInfo(job.timezone))
+ scheduled_dt = max(now_dt, push_dt)
self._schedule_event(
- datetime.fromtimestamp(self._now_fn(), tz=ZoneInfo(job.timezone)),
+ scheduled_dt,
"push_update", job.id, run_id,
)