Skip to content

Commit

Permalink
task finally
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaukutsu committed Dec 16, 2023
1 parent 4403c32 commit ddef4c9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/EntityFinally.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
7 changes: 5 additions & 2 deletions src/handler/TaskFinallyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/processing/TaskHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit ddef4c9

Please sign in to comment.