[#217] Casting get_next to datetime to prevent DST issues

This commit is contained in:
Fabio Manganiello 2022-04-28 23:29:45 +02:00
parent e9454b0c0f
commit 55958c1b57
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -90,8 +90,8 @@ class Cronjob(threading.Thread):
now = get_now() now = get_now()
self._event_type = CronjobEvent.NONE self._event_type = CronjobEvent.NONE
cron = croniter.croniter(self.cron_expression, now) cron = croniter.croniter(self.cron_expression, now)
next_run = cron.get_next() next_run = cron.get_next(datetime.datetime)
self._event.wait(max(0, next_run - now.timestamp())) self._event.wait(max(0, (next_run - now).total_seconds()))
def stop(self): def stop(self):
self._event_type = CronjobEvent.STOP self._event_type = CronjobEvent.STOP