mirror of
https://github.com/shlinkio/shlink.git
synced 2026-09-03 19:52:51 -05:00
Simplified RoadRunner worker, and fixed RoadRunner reloading config
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user