From bd751ca61f2b705b56a8f940f2e67261d6d961da Mon Sep 17 00:00:00 2001 From: "Mathias L. Baumann" Date: Wed, 23 Oct 2024 13:50:32 +0200 Subject: [PATCH] Fix recurrence. Recurrence didn't properly work as we passed in the empty list for the by-* fiedls by default which means "No valid time-unit", e.g bymonth=[] means no month at all. never. Signed-off-by: Mathias L. Baumann --- RELEASE_NOTES.md | 2 +- src/frequenz/dispatch/_dispatch.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 1cd52ad..6880d6c 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -2,4 +2,4 @@ ## Summary -* `frequenz-sdk` dependency has been extended to include version `1.0.0-rc1000`. +This is a hot fix for recurrence not working diff --git a/src/frequenz/dispatch/_dispatch.py b/src/frequenz/dispatch/_dispatch.py index fab20c8..792170e 100644 --- a/src/frequenz/dispatch/_dispatch.py +++ b/src/frequenz/dispatch/_dispatch.py @@ -222,13 +222,14 @@ def _prepare_rrule(self) -> rrule.rrule: dtstart=self.start_time, count=count, until=until, - byminute=self.recurrence.byminutes, - byhour=self.recurrence.byhours, + byminute=self.recurrence.byminutes or None, + byhour=self.recurrence.byhours or None, byweekday=[ _RRULE_WEEKDAY_MAP[weekday] for weekday in self.recurrence.byweekdays - ], - bymonthday=self.recurrence.bymonthdays, - bymonth=self.recurrence.bymonths, + ] + or None, + bymonthday=self.recurrence.bymonthdays or None, + bymonth=self.recurrence.bymonths or None, interval=self.recurrence.interval, )