diff --git a/src/frequenz/dispatch/actor.py b/src/frequenz/dispatch/actor.py index d8dd3e8..104ae57 100644 --- a/src/frequenz/dispatch/actor.py +++ b/src/frequenz/dispatch/actor.py @@ -266,10 +266,11 @@ def _schedule_start(self, dispatch: Dispatch) -> None: return # Schedule the next run - next_run = dispatch.next_run - assert next_run is not None - heappush(self._scheduled_events, (next_run, dispatch)) - _logger.debug("Scheduled dispatch %s to start at %s", dispatch, next_run) + if next_run := dispatch.next_run: + heappush(self._scheduled_events, (next_run, dispatch)) + _logger.debug("Scheduled dispatch %s to start at %s", dispatch.id, next_run) + else: + _logger.debug("Dispatch %s has no next run", dispatch.id) def _schedule_stop(self, dispatch: Dispatch) -> None: """Schedule a dispatch to stop.