From 2e13570dd79c79b4f9dffbcdfebb74b2cdeb9c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=A0Ja=CC=81n=20Mikla=CC=81s=CC=8C?= Date: Mon, 22 Jul 2024 22:32:46 +0200 Subject: [PATCH] Correctly complete automation run when there is an empty branch in if/else [MAILPOET-6154] --- mailpoet/lib/Automation/Engine/Control/StepHandler.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mailpoet/lib/Automation/Engine/Control/StepHandler.php b/mailpoet/lib/Automation/Engine/Control/StepHandler.php index 40eda6fe01..1458d2a6b7 100644 --- a/mailpoet/lib/Automation/Engine/Control/StepHandler.php +++ b/mailpoet/lib/Automation/Engine/Control/StepHandler.php @@ -150,6 +150,13 @@ class StepHandler { $step->validate($validationArgs); $step->run($args, $this->stepRunControllerFactory->createController($args)); + // check if run is not completed by now (e.g., one of if/else branches is empty) + $automationRun = $this->automationRunStorage->getAutomationRun($runId); + if ($automationRun && $automationRun->getStatus() !== AutomationRun::STATUS_RUNNING) { + $logger->logSuccess(); + return; + } + // schedule next step if not scheduled by action if (!$this->stepScheduler->hasScheduledStep($args)) { $this->stepScheduler->scheduleNextStep($args);