When unscheduling automation run actions, cancel related runs
[MAILPOET-6131]
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
|
||||
namespace MailPoet\Automation\Engine\Builder;
|
||||
|
||||
use ActionScheduler_Store;
|
||||
use MailPoet\Automation\Engine\Control\ActionScheduler;
|
||||
use MailPoet\Automation\Engine\Data\Automation;
|
||||
use MailPoet\Automation\Engine\Data\AutomationRun;
|
||||
use MailPoet\Automation\Engine\Data\Step;
|
||||
use MailPoet\Automation\Engine\Exceptions;
|
||||
use MailPoet\Automation\Engine\Exceptions\UnexpectedValueException;
|
||||
@@ -161,11 +163,13 @@ class UpdateAutomationController {
|
||||
$runIds = [];
|
||||
$runs = $this->automationRunStorage->getAutomationRunsForAutomation($automation);
|
||||
foreach ($runs as $run) {
|
||||
if ($run->getStatus() === AutomationRun::STATUS_RUNNING) {
|
||||
$this->automationRunStorage->updateStatus($run->getId(), AutomationRun::STATUS_CANCELLED);
|
||||
}
|
||||
$runIds[$run->getId()] = $run;
|
||||
}
|
||||
|
||||
$actions = $this->actionScheduler->getScheduledActions(['hook' => Hooks::AUTOMATION_STEP, 'status' => \ActionScheduler_Store::STATUS_PENDING]);
|
||||
|
||||
$actions = $this->actionScheduler->getScheduledActions(['hook' => Hooks::AUTOMATION_STEP, 'status' => ActionScheduler_Store::STATUS_PENDING]);
|
||||
foreach ($actions as $action) {
|
||||
$args = $action->get_args();
|
||||
$automationArgs = reset($args);
|
||||
|
Reference in New Issue
Block a user