Skip to content

Commit 02161e7

Browse files
fix events
1 parent 2aaaa3f commit 02161e7

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/Manager/ProcessManager.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,27 @@ public function getTaskConfiguration(): ?TaskConfiguration
9393
public function execute(string $processCode, mixed $input = null, array $context = []): mixed
9494
{
9595
try {
96-
$this->eventDispatcher->dispatch(new ProcessEvent($processCode, $input, $context));
96+
$this->eventDispatcher->dispatch(
97+
new ProcessEvent($processCode, $input, $context),
98+
ProcessEvent::EVENT_PROCESS_STARTED
99+
);
97100
$this->processLogger->debug('Process start');
98101

99102
$result = $this->doExecute($processCode, $input, $context);
100103

101104
$this->processLogger->debug('Process end');
102-
$this->eventDispatcher->dispatch(new ProcessEvent($processCode, $input, $context, $result));
105+
$this->eventDispatcher->dispatch(
106+
new ProcessEvent($processCode, $input, $context, $result),
107+
ProcessEvent::EVENT_PROCESS_ENDED
108+
);
103109
} catch (Throwable $error) {
104110
$this->processLogger->critical('Critical process failure', [
105111
'error' => $error->getMessage(),
106112
]);
107-
$this->eventDispatcher->dispatch(new ProcessEvent($processCode, $input, $context, null, $error));
113+
$this->eventDispatcher->dispatch(
114+
new ProcessEvent($processCode, $input, $context, null, $error),
115+
ProcessEvent::EVENT_PROCESS_FAILED
116+
);
108117

109118
throw $error;
110119
}

0 commit comments

Comments
 (0)