Skip to content

Commit bdc52f1

Browse files
authored
fix: change CronTrigger next_fire start time (#1718)
Replaces the croniter start_time in CronTrigger from `datetime.now()` to `self.last_call_time.astimezone()` to fix a bug causing possible multiple firing. Fixes #1717
1 parent fcd8efe commit bdc52f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

interactions/models/internal/tasks/triggers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,4 @@ def __init__(self, cron: str, tz: "_TzInfo" = timezone.utc) -> None:
163163
self.tz = tz
164164

165165
def next_fire(self) -> datetime | None:
166-
return croniter(self.cron, datetime.now(tz=self.tz)).next(datetime)
166+
return croniter(self.cron, self.last_call_time.astimezone(self.tz)).next(datetime)

0 commit comments

Comments
 (0)