Reuse StepRunLogger to avoid overwrites
The SendEmailAction step needs to log arbitrary data to allow retry-runs, through a StepRunLogger. We previously instanciated a logger from the action, but this data will be overwritten by the handler right after the action is run. This is because the handler holds a reference to a logger already, and will overwrite any data the action tries to write. To work around this issue, the step handler now passes its logger instance to the step's controller, allowing safe access from SendEmailAction. [MAILPOET-6176]
This commit is contained in:
committed by
Aschepikov
parent
3300510dc2
commit
815ff9211b
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace MailPoet\Automation\Engine\Control;
|
||||
|
||||
use MailPoet\Automation\Engine\Control\StepRunLogger;
|
||||
use MailPoet\Automation\Engine\Data\StepRunArgs;
|
||||
|
||||
class StepRunControllerFactory {
|
||||
@@ -14,7 +15,7 @@ class StepRunControllerFactory {
|
||||
$this->stepScheduler = $stepScheduler;
|
||||
}
|
||||
|
||||
public function createController(StepRunArgs $args): StepRunController {
|
||||
return new StepRunController($this->stepScheduler, $args);
|
||||
public function createController(StepRunArgs $args, StepRunLogger $logger): StepRunController {
|
||||
return new StepRunController($this->stepScheduler, $args, $logger);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user