Simplified RoadRunner worker, and fixed RoadRunner reloading config

This commit is contained in:
Alejandro Celaya
2022-08-27 08:01:57 +02:00
parent 86159c5d86
commit c5b6d203f5
4 changed files with 26 additions and 14 deletions
+4 -11
View File
@@ -4,27 +4,20 @@ declare(strict_types=1);
use Mezzio\Application;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ServerRequestFactoryInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\UploadedFileFactoryInterface;
use Shlinkio\Shlink\EventDispatcher\RoadRunner\RoadRunnerTaskConsumerToListener;
use Spiral\RoadRunner\Http\PSR7Worker;
use Spiral\RoadRunner\Worker;
use function Shlinkio\Shlink\Config\env;
(static function (): void {
$rrMode = getenv('RR_MODE');
/** @var ContainerInterface $container */
$container = include __DIR__ . '/../config/container.php';
$rrMode = env('RR_MODE');
if ($rrMode === 'http') {
// This was spin-up as a web worker
$app = $container->get(Application::class);
$worker = new PSR7Worker(
Worker::create(),
$container->get(ServerRequestFactoryInterface::class),
$container->get(StreamFactoryInterface::class),
$container->get(UploadedFileFactoryInterface::class),
);
$worker = $container->get(PSR7Worker::class);
while ($req = $worker->waitRequest()) {
try {