Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
2.3.4
=====

* (bug) Add missing run integration for `DispatchAfterRunTaskHandler`.


2.3.3
=====

* (improvement) Simplify task run duration calculation.
* (improvement) Transform exception to log entry, so that the worker doesn't constantly fail.
* (deprecation) Deprecate entity getters in favor of properties.
* (improvement) Add explicit task class field.
* (improvement) Add explicit task `class` field.


2.3.2
Expand Down
2 changes: 1 addition & 1 deletion src/Director/RunDirector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final class RunDirector
{
private TorrStyle $io;
public private(set) TorrStyle $io;
private ChainOutput $output;

/**
Expand Down
10 changes: 10 additions & 0 deletions src/Task/DispatchAfterRunTask/DispatchAfterRunTaskHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Stamp\TransportNamesStamp;
use Torr\TaskManager\Director\TaskDirector;
use Torr\TaskManager\Manager\TaskManager;

/**
Expand All @@ -15,6 +16,7 @@
*/
public function __construct (
private TaskManager $taskManager,
private TaskDirector $taskDirector,
) {}

/**
Expand All @@ -23,10 +25,18 @@ public function __construct (
#[AsMessageHandler]
public function onDispatchAfterRunTask (DispatchAfterRunTask $task) : void
{
$run = $this->taskDirector->startRun($task);

$run->io->writeln(\sprintf(
"Redispatching task <fg=yellow>%s</>",
$task->task::class,
));

$stamps = !empty($task->transportNames)
? [new TransportNamesStamp($task->transportNames)]
: [];

$this->taskManager->enqueue($task->task, $stamps);
$run->finish(success: true);
}
}