From ae827fdce3960bbd671697d9a2537afcc7b4ae4f Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Tue, 11 Jan 2022 11:56:02 +0100 Subject: [PATCH] Fix: Sign error in wait_handler --- src/automations/flow.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/automations/flow.py b/src/automations/flow.py index 582a977..031e340 100644 --- a/src/automations/flow.py +++ b/src/automations/flow.py @@ -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 ) @@ -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