From 55958c1b573a083db8cb2ee851ca264679ff2f75 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 28 Apr 2022 23:29:45 +0200 Subject: [PATCH] [#217] Casting `get_next` to `datetime` to prevent DST issues --- platypush/cron/scheduler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platypush/cron/scheduler.py b/platypush/cron/scheduler.py index 0671cfd0..86fbff62 100644 --- a/platypush/cron/scheduler.py +++ b/platypush/cron/scheduler.py @@ -90,8 +90,8 @@ class Cronjob(threading.Thread): now = get_now() self._event_type = CronjobEvent.NONE cron = croniter.croniter(self.cron_expression, now) - next_run = cron.get_next() - self._event.wait(max(0, next_run - now.timestamp())) + next_run = cron.get_next(datetime.datetime) + self._event.wait(max(0, (next_run - now).total_seconds())) def stop(self): self._event_type = CronjobEvent.STOP