From 6b34f7f0eb95da71703790ea67462ac8fc5d61d7 Mon Sep 17 00:00:00 2001 From: Anton Date: Sun, 11 Feb 2024 01:34:26 +0800 Subject: [PATCH] Processes configuration fixes --- src/Runner.php | 2 +- src/Worker/ProcessWorker.php | 4 ++-- src/Worker/SchedulerWorker.php | 4 +--- src/config/configuration.php | 4 ++++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Runner.php b/src/Runner.php index dfe2331..0534656 100644 --- a/src/Runner.php +++ b/src/Runner.php @@ -62,7 +62,7 @@ public function run(): int group: $config['group'], name: $processConfig['name'], command: $processConfig['command'], - processes: $processConfig['processes'], + count: $processConfig['count'], )); } diff --git a/src/Worker/ProcessWorker.php b/src/Worker/ProcessWorker.php index db05600..a606d2d 100644 --- a/src/Worker/ProcessWorker.php +++ b/src/Worker/ProcessWorker.php @@ -18,11 +18,11 @@ public function __construct( string|null $group, string|null $name, private readonly string $command, - int $processes, + int $count, ) { parent::__construct( name: $name ?? $command, - count: $processes, + count: $count, user: $user, group: $group, onStart: $this->onStart(...), diff --git a/src/Worker/SchedulerWorker.php b/src/Worker/SchedulerWorker.php index b58b6ee..733dcaf 100644 --- a/src/Worker/SchedulerWorker.php +++ b/src/Worker/SchedulerWorker.php @@ -138,9 +138,7 @@ private function runSymfonyCommand(Application $application, string $command): i } // Execute in a forked process - $identifiers = $this->getEventLoop()->getIdentifiers(); - \array_walk($identifiers, $this->getEventLoop()->disable(...)); - $this->getEventLoop()->stop(); + $this->detach(); \cli_set_process_title($command); \pcntl_signal(SIGINT, SIG_IGN); diff --git a/src/config/configuration.php b/src/config/configuration.php index afc0a87..f4b39a1 100644 --- a/src/config/configuration.php +++ b/src/config/configuration.php @@ -96,6 +96,10 @@ ->isRequired() ->cannotBeEmpty() ->end() + ->integerNode('count') + ->info('Processes count') + ->defaultValue(1) + ->end() ->end() ->end() ->end()