Extract subject loading before automation processing loop

[MAILPOET-4946]
This commit is contained in:
Jan Jakes
2023-03-31 11:37:45 +02:00
committed by Aschepikov
parent 70dbfc28b7
commit 54f5addca9

View File

@ -64,19 +64,19 @@ class TriggerHandler {
return;
}
// ensure subjects are registered and loadable
$subjects = $this->subjectTransformerHandler->getAllSubjects($subjects);
$subjectEntries = $this->subjectLoader->getSubjectsEntries($subjects);
foreach ($subjectEntries as $entry) {
$entry->getPayload();
}
foreach ($automations as $automation) {
$step = $automation->getTrigger($trigger->getKey());
if (!$step) {
throw Exceptions::automationTriggerNotFound($automation->getId(), $trigger->getKey());
}
// ensure subjects are registered and loadable
$subjectEntries = $this->subjectLoader->getSubjectsEntries($subjects);
foreach ($subjectEntries as $entry) {
$entry->getPayload();
}
$automationRun = new AutomationRun($automation->getId(), $automation->getVersionId(), $trigger->getKey(), $subjects);
$stepRunArgs = new StepRunArgs($automation, $automationRun, $step, $subjectEntries);
$createAutomationRun = $trigger->isTriggeredBy($stepRunArgs);