From 676ed15e28295bd63b552115113c5c01b9ed8061 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 1 May 2026 13:31:55 -0700 Subject: [PATCH] address greptile review feedback (greploop iteration 7) - Reject zero-interval schedule_spec to prevent unbounded firing loop - Use normalized (tz-aware) expires_at when persisting in CREATE path Co-Authored-By: Claude Opus 4.6 --- litellm/proxy/scheduled_tasks/endpoints.py | 2 +- litellm/proxy/scheduled_tasks/schedule.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/scheduled_tasks/endpoints.py b/litellm/proxy/scheduled_tasks/endpoints.py index 8d1c89b6215..1990eb6e646 100644 --- a/litellm/proxy/scheduled_tasks/endpoints.py +++ b/litellm/proxy/scheduled_tasks/endpoints.py @@ -166,7 +166,7 @@ async def create_scheduled_task( schedule_spec=data.schedule_spec, schedule_tz=data.schedule_tz, next_run_at=next_run_at, - expires_at=data.expires_at, + expires_at=expires_at, fire_once=fire_once, ) return _row_to_response(row) diff --git a/litellm/proxy/scheduled_tasks/schedule.py b/litellm/proxy/scheduled_tasks/schedule.py index b4442224e1f..bb22df4e2f7 100644 --- a/litellm/proxy/scheduled_tasks/schedule.py +++ b/litellm/proxy/scheduled_tasks/schedule.py @@ -22,7 +22,7 @@ from apscheduler.triggers.cron import ( # type: ignore[import-not-found, import ) -_INTERVAL_RE = re.compile(r"^\s*(\d+)\s*([smhd])\s*$", re.IGNORECASE) +_INTERVAL_RE = re.compile(r"^\s*([1-9]\d*)\s*([smhd])\s*$", re.IGNORECASE) _INTERVAL_UNITS = { "s": "seconds", "m": "minutes",