From ddef4c951a6920fb53035f3a14c9f54ac312690b Mon Sep 17 00:00:00 2001 From: Dmitriy Krivopalov Date: Sat, 16 Dec 2023 13:45:12 +0300 Subject: [PATCH] task finally --- src/EntityFinally.php | 5 ++++- src/handler/TaskFinallyHandler.php | 7 +++++-- src/processing/TaskHandler.php | 7 ++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/EntityFinally.php b/src/EntityFinally.php index b8e5c4a..778d75c 100644 --- a/src/EntityFinally.php +++ b/src/EntityFinally.php @@ -8,5 +8,8 @@ interface EntityFinally { - public function handle(TaskStateInterface $state): void; + /** + * @param non-empty-string $uuid Task UUID + */ + public function handle(string $uuid, TaskStateInterface $state): void; } diff --git a/src/handler/TaskFinallyHandler.php b/src/handler/TaskFinallyHandler.php index a9aa429..b8f8c28 100644 --- a/src/handler/TaskFinallyHandler.php +++ b/src/handler/TaskFinallyHandler.php @@ -22,14 +22,17 @@ public function __construct(private readonly ContainerInterface $container) { } - public function handle(TaskOptions $options, TaskStateInterface $state): void + /** + * @param non-empty-string $uuid Task UUID + */ + public function handle(string $uuid, TaskOptions $options, TaskStateInterface $state): void { if ($options->finally === null) { return; } try { - $this->factory($options->finally)->handle($state); + $this->factory($options->finally)->handle($uuid, $state); } catch (Throwable) { } } diff --git a/src/processing/TaskHandler.php b/src/processing/TaskHandler.php index a4551ae..f08af2e 100644 --- a/src/processing/TaskHandler.php +++ b/src/processing/TaskHandler.php @@ -109,7 +109,12 @@ public function complete(string $taskUuid, string $stageUuid): TaskStateInterfac return $stateRelation; } - $this->finallyHandler->handle($task->getOptions(), $state); + $this->finallyHandler->handle( + $task->getUuid(), + $task->getOptions(), + $state, + ); + return $state; }