diff --git a/src/Bootloader/CommandBootloader.php b/src/Bootloader/CommandBootloader.php index dbad6ad..ba65640 100644 --- a/src/Bootloader/CommandBootloader.php +++ b/src/Bootloader/CommandBootloader.php @@ -41,6 +41,10 @@ private function configureJobs(ConsoleBootloader $console): void $console->addCommand(Queue\PauseCommand::class); $console->addCommand(Queue\ResumeCommand::class); $console->addCommand(Queue\ListCommand::class); + + $console->addCommand(Queue\DeprecatedPauseCommand::class); + $console->addCommand(Queue\DeprecatedResumeCommand::class); + $console->addCommand(Queue\DeprecatedListCommand::class); } private function configureCache(ConsoleBootloader $console): void diff --git a/src/Console/Command/Cache/ClearCommand.php b/src/Console/Command/Cache/ClearCommand.php index 4384c47..bc5f141 100644 --- a/src/Console/Command/Cache/ClearCommand.php +++ b/src/Console/Command/Cache/ClearCommand.php @@ -7,13 +7,18 @@ use Spiral\Cache\CacheStorageProviderInterface; use Spiral\Console\Command; +/** + * @deprecated Will be removed in the next major release of RoadRunner Bridge (version 3.0) + */ final class ClearCommand extends Command { protected const SIGNATURE = 'cache:clear {storage? : Storage name}'; - protected const DESCRIPTION = 'Clear cache'; + protected const DESCRIPTION = 'Clears the cache for the specified storage in the Spiral cache component.'; public function perform(CacheStorageProviderInterface $provider): int { + $this->warning('WARNING: This command has been deprecated and will be removed in the next major release of RoadRunner Bridge (version 3.0).'); + if ($this->isVerbose()) { $this->writeln('Cleaning application cache:'); } diff --git a/src/Console/Command/Queue/DeprecatedListCommand.php b/src/Console/Command/Queue/DeprecatedListCommand.php new file mode 100644 index 0000000..390cc48 --- /dev/null +++ b/src/Console/Command/Queue/DeprecatedListCommand.php @@ -0,0 +1,26 @@ +warning( + 'WARNING: This command has been deprecated and will be removed in the next major release of RoadRunner Bridge (version 3.0).', + ); + + return $console->run('rr:jobs:list', [], $this->output)->getCode(); + } +} diff --git a/src/Console/Command/Queue/DeprecatedPauseCommand.php b/src/Console/Command/Queue/DeprecatedPauseCommand.php new file mode 100644 index 0000000..daf6447 --- /dev/null +++ b/src/Console/Command/Queue/DeprecatedPauseCommand.php @@ -0,0 +1,28 @@ +warning( + 'WARNING: This command has been deprecated and will be removed in the next major release of RoadRunner Bridge (version 3.0).', + ); + + return $console->run('rr:jobs:pause', [ + 'pipeline' => $this->argument('pipeline'), + ], $this->output)->getCode(); + } +} diff --git a/src/Console/Command/Queue/DeprecatedResumeCommand.php b/src/Console/Command/Queue/DeprecatedResumeCommand.php new file mode 100644 index 0000000..2742d08 --- /dev/null +++ b/src/Console/Command/Queue/DeprecatedResumeCommand.php @@ -0,0 +1,28 @@ +warning( + 'WARNING: This command has been deprecated and will be removed in the next major release of RoadRunner Bridge (version 3.0).', + ); + + return $console->run('rr:jobs:pause', [ + 'pipeline' => $this->argument('pipeline'), + ], $this->output)->getCode(); + } +} diff --git a/src/Console/Command/Queue/ListCommand.php b/src/Console/Command/Queue/ListCommand.php index a9654d8..d2b2926 100644 --- a/src/Console/Command/Queue/ListCommand.php +++ b/src/Console/Command/Queue/ListCommand.php @@ -11,21 +11,23 @@ final class ListCommand extends Command { - protected const SIGNATURE = 'roadrunner:list'; - protected const DESCRIPTION = 'List available roadrunner pipelines'; + protected const SIGNATURE = 'rr:jobs:list'; + protected const DESCRIPTION = 'Displays a list of available job pipelines for the RoadRunner'; public function perform(JobsInterface $jobs): int { $queues = \iterator_to_array($jobs->getIterator()); if ($queues === []) { + $this->info('No job pipelines are currently declared for the RoadRunner.'); + return self::SUCCESS; } $table = new Table($this->output); $table->setHeaders( - ['Name', 'Driver', 'Priority', 'Active jobs', 'Delayed jobs', 'Reserved jobs', 'Is active'] + ['Name', 'Driver', 'Priority', 'Active jobs', 'Delayed jobs', 'Reserved jobs', 'Is active'], ); foreach ($queues as $queue) { diff --git a/src/Console/Command/Queue/PauseCommand.php b/src/Console/Command/Queue/PauseCommand.php index 1caf22c..f38dc02 100644 --- a/src/Console/Command/Queue/PauseCommand.php +++ b/src/Console/Command/Queue/PauseCommand.php @@ -9,8 +9,8 @@ final class PauseCommand extends Command { - protected const SIGNATURE = 'roadrunner:pause {pipeline : Pipeline name}'; - protected const DESCRIPTION = 'Pause consuming jobs for pipeline with given name'; + protected const SIGNATURE = 'rr:jobs:pause {pipeline : Pipeline name}'; + protected const DESCRIPTION = 'Pauses the consumption of jobs for the specified pipeline in the RoadRunner.'; public function perform(JobsInterface $jobs): int { diff --git a/src/Console/Command/Queue/ResumeCommand.php b/src/Console/Command/Queue/ResumeCommand.php index 4197d05..49f1c4e 100644 --- a/src/Console/Command/Queue/ResumeCommand.php +++ b/src/Console/Command/Queue/ResumeCommand.php @@ -9,8 +9,8 @@ final class ResumeCommand extends Command { - protected const SIGNATURE = 'roadrunner:resume {pipeline : Pipeline name}'; - protected const DESCRIPTION = 'Resume consuming jobs for pipeline with given name'; + protected const SIGNATURE = 'rr:jobs:consume {pipeline : Pipeline name}'; + protected const DESCRIPTION = 'Resumes the consumption of jobs for the specified pipeline in the RoadRunner.'; public function perform(JobsInterface $jobs): int { diff --git a/tests/app/GRPC/Generator/Bootloader/ExpectedBootloader.php b/tests/app/GRPC/Generator/Bootloader/ExpectedBootloader.php index e927c95..2f45455 100644 --- a/tests/app/GRPC/Generator/Bootloader/ExpectedBootloader.php +++ b/tests/app/GRPC/Generator/Bootloader/ExpectedBootloader.php @@ -16,8 +16,9 @@ class ServiceBootloader extends Bootloader { - public function __construct(public ConfiguratorInterface $config) - { + public function __construct( + public ConfiguratorInterface $config, + ) { } public function init(EnvironmentInterface $env): void diff --git a/tests/app/GRPC/Generator/ExpectedServiceClient.php b/tests/app/GRPC/Generator/ExpectedServiceClient.php index fe9fad4..2e73bca 100644 --- a/tests/app/GRPC/Generator/ExpectedServiceClient.php +++ b/tests/app/GRPC/Generator/ExpectedServiceClient.php @@ -9,8 +9,9 @@ class UsersServiceClient implements UsersServiceInterface { - public function __construct(public InterceptableCore $core) - { + public function __construct( + public InterceptableCore $core, + ) { } public function Auth(ContextInterface $ctx, DTO\AuthRequest $in): DTO\AuthResponse diff --git a/tests/src/Bootloader/CentrifugoBootloaderTest.php b/tests/src/Bootloader/CentrifugoBootloaderTest.php index 99b07ef..ba4e68f 100644 --- a/tests/src/Bootloader/CentrifugoBootloaderTest.php +++ b/tests/src/Bootloader/CentrifugoBootloaderTest.php @@ -44,6 +44,9 @@ public function testCentrifugoWorkerShouldBeSingleton(): void CentrifugoWorkerInterface::class, CentrifugoWorker::class ); + + // TODO fix problem with rr worker + ob_end_flush(); } public function testErrorHandlerShouldBeSingleton(): void diff --git a/tests/src/Console/Command/Queue/ListCommandTest.php b/tests/src/Console/Command/Queue/ListCommandTest.php index 2493edb..bc32e3a 100644 --- a/tests/src/Console/Command/Queue/ListCommandTest.php +++ b/tests/src/Console/Command/Queue/ListCommandTest.php @@ -58,7 +58,7 @@ public function testGetsListOfAvailablePipelines() | default | amqp | 250 | 110 | 88 | 56 | ✖ | +---------+--------+----------+-------------+--------------+---------------+-----------+ EOL, - $this->runCommand('roadrunner:list') + $this->runCommand('rr:jobs:list') ); } } diff --git a/tests/src/Console/Command/Queue/PauseCommandTest.php b/tests/src/Console/Command/Queue/PauseCommandTest.php index 2475598..3f85b5b 100644 --- a/tests/src/Console/Command/Queue/PauseCommandTest.php +++ b/tests/src/Console/Command/Queue/PauseCommandTest.php @@ -16,7 +16,7 @@ public function testPausePipeline() $jobs->shouldReceive('pause')->once()->with('foo'); - $result = $this->runCommand('roadrunner:pause', ['pipeline' => 'foo']); + $result = $this->runCommand('rr:jobs:pause', ['pipeline' => 'foo']); $this->assertStringContainsString('Pipeline [foo] has been paused.', $result); } } diff --git a/tests/src/Console/Command/Queue/ResumeCommandTest.php b/tests/src/Console/Command/Queue/ResumeCommandTest.php index 841131f..4dc3e86 100644 --- a/tests/src/Console/Command/Queue/ResumeCommandTest.php +++ b/tests/src/Console/Command/Queue/ResumeCommandTest.php @@ -16,7 +16,7 @@ public function testPausePipeline() $jobs->shouldReceive('resume')->once()->with('foo'); - $result = $this->runCommand('roadrunner:resume', ['pipeline' => 'foo']); + $result = $this->runCommand('rr:jobs:consume', ['pipeline' => 'foo']); $this->assertStringContainsString('Pipeline [foo] has been resumed.', $result); } }