Skip to content

Commit bcd5c0f

Browse files
committed
Fix wrong Dispatch.running() behavior with duration=None
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 432b3cb commit bcd5c0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/frequenz/dispatch/_dispatch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ def running(self, type_: str) -> RunningState:
119119

120120
now = datetime.now(tz=timezone.utc)
121121

122+
if now < self.start_time:
123+
return RunningState.STOPPED
122124
# A dispatch without duration is always running once it started
123125
if self.duration is None:
124-
if self.start_time <= now:
125-
return RunningState.RUNNING
126-
return RunningState.STOPPED
126+
return RunningState.RUNNING
127127

128128
if until := self._until(now):
129129
return RunningState.RUNNING if now < until else RunningState.STOPPED

0 commit comments

Comments
 (0)