Skip to content

Commit

Permalink
Fix: Sign error in wait_handler
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Jan 11, 2022
1 parent 085f321 commit ae827fd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/automations/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ def leave(self, task: models.AutomationTaskModel):
return next_node

def pause_automation(self, earliest_execution):
if self._automation._db.paused_until:
if (
self._automation._db.paused_until
and self._automation._db.paused_until >= now()
):
self._automation._db.paused_until = min(
self._automation._db.paused_until, earliest_execution
)
Expand All @@ -215,9 +218,9 @@ def wait_handler(self, task: models.AutomationTaskModel):
return task
earliest_execution = self.eval(self._wait, task)
if earliest_execution < now():
self.pause_automation(earliest_execution)
self._automation._db.save()
return task
self.pause_automation(earliest_execution)
self._automation._db.save()
return self.release_lock(task)

@on_execution_path
Expand Down

0 comments on commit ae827fd

Please sign in to comment.