Add the possibility to schedule another run of the same step (progress)

[MAILPOET-5569]
This commit is contained in:
Jan Jakes
2023-08-17 16:02:54 +02:00
committed by Aschepikov
parent eeb4d64e8b
commit e5550ffead
2 changed files with 17 additions and 3 deletions

View File

@@ -22,6 +22,12 @@ class StepScheduler {
$this->automationRunStorage = $automationRunStorage;
}
public function scheduleProgress(StepRunArgs $args, int $timestamp = null): int {
$runId = $args->getAutomationRun()->getId();
$data = $this->getActionData($runId, $args->getStep()->getId(), $args->getRunNumber() + 1);
return $this->scheduleStepAction($data, $timestamp);
}
public function scheduleNextStep(StepRunArgs $args, int $timestamp = null): int {
$runId = $args->getAutomationRun()->getId();
@@ -58,6 +64,16 @@ class StepScheduler {
return false;
}
public function hasScheduledProgress(StepRunArgs $args): bool {
$runId = $args->getAutomationRun()->getId();
$data = $this->getActionData($runId, $args->getStep()->getId(), $args->getRunNumber() + 1);
return $this->actionScheduler->hasScheduledAction(Hooks::AUTOMATION_STEP, $data);
}
public function hasScheduledStep(StepRunArgs $args): bool {
return $this->hasScheduledNextStep($args) || $this->hasScheduledProgress($args);
}
private function scheduleStepAction(array $data, int $timestamp = null): int {
return $timestamp === null
? $this->actionScheduler->enqueue(Hooks::AUTOMATION_STEP, $data)