Skip to content
Merged
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
12 changes: 10 additions & 2 deletions src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Mammatus\LifeCycleEvents\Shutdown;
use Mammatus\Queue\Generated\AbstractList;
use Psr\Log\LoggerInterface;
use React\EventLoop\Loop;
use Throwable;
use WyriHaximus\Broadcast\Contracts\Listener;
use WyriHaximus\PSR3\ContextLogger\ContextLogger;
Expand All @@ -30,7 +31,8 @@ public function stop(Shutdown $event): void

public function run(string $className): int
{
return await(async(function (string $className): int {
$exitCode = 2;
async(function (string $className): int {
$logger = new ContextLogger($this->logger, ['worker' => $className]);
try {
$promises = [];
Expand All @@ -52,6 +54,12 @@ public function run(string $className): int
}

return $exitCode;
})($className));
})($className)->then(static function (int $resultingExitCode) use (&$exitCode): void {
$exitCode = $resultingExitCode;
});

Loop::run();

return $exitCode;
}
}
Loading