Add the possibility to schedule another run of the same step (progress)
[MAILPOET-5569]
This commit is contained in:
@@ -183,11 +183,9 @@ class StepHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// schedule next step if not scheduled by action
|
// schedule next step if not scheduled by action
|
||||||
if (!$this->stepScheduler->hasScheduledNextStep($args)) {
|
if (!$this->stepScheduler->hasScheduledStep($args)) {
|
||||||
$this->stepScheduler->scheduleNextStep($args);
|
$this->stepScheduler->scheduleNextStep($args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: allow long-running steps (that are not done here yet)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return SubjectEntry<Subject<Payload>>[] */
|
/** @return SubjectEntry<Subject<Payload>>[] */
|
||||||
|
@@ -22,6 +22,12 @@ class StepScheduler {
|
|||||||
$this->automationRunStorage = $automationRunStorage;
|
$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 {
|
public function scheduleNextStep(StepRunArgs $args, int $timestamp = null): int {
|
||||||
$runId = $args->getAutomationRun()->getId();
|
$runId = $args->getAutomationRun()->getId();
|
||||||
|
|
||||||
@@ -58,6 +64,16 @@ class StepScheduler {
|
|||||||
return false;
|
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 {
|
private function scheduleStepAction(array $data, int $timestamp = null): int {
|
||||||
return $timestamp === null
|
return $timestamp === null
|
||||||
? $this->actionScheduler->enqueue(Hooks::AUTOMATION_STEP, $data)
|
? $this->actionScheduler->enqueue(Hooks::AUTOMATION_STEP, $data)
|
||||||
|
Reference in New Issue
Block a user