Skip to content
Closed
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions src/Illuminate/Queue/Console/PauseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Console\Command;
use Illuminate\Contracts\Queue\Factory as QueueManager;
use Illuminate\Queue\Console\Concerns\ParsesQueue;
use Illuminate\Queue\Worker;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'queue:pause')]
Expand Down Expand Up @@ -33,6 +34,12 @@ class PauseCommand extends Command
*/
public function handle(QueueManager $manager)
{
if (! Worker::$pausable) {
$this->components->error('Worker::$pausable must be set to true to use this command.');

return 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left this as 1 - as its returning 0 down below. I'll probably do another PR to normalize them all to use self::SUCCESS / FAILURE if this is merged 🤷🏻

}

[$connection, $queue] = $this->parseQueue($this->argument('queue'));

$manager->pause($connection, $queue);
Expand Down
11 changes: 10 additions & 1 deletion src/Illuminate/Queue/Console/RestartCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Console\Command;
use Illuminate\Contracts\Cache\Repository as Cache;
use Illuminate\Queue\Worker;
use Illuminate\Support\InteractsWithTime;
use Symfony\Component\Console\Attribute\AsCommand;

Expand Down Expand Up @@ -48,12 +49,20 @@ public function __construct(Cache $cache)
/**
* Execute the console command.
*
* @return void
* @return int
*/
public function handle()
{
if (! Worker::$restartable) {
$this->components->error('Worker::$restartable must be set to true to use this command.');

return self::FAILURE;
}

$this->cache->forever('illuminate:queue:restart', $this->currentTime());

$this->components->info('Broadcasting queue restart signal.');

return self::SUCCESS;
}
}
7 changes: 7 additions & 0 deletions src/Illuminate/Queue/Console/ResumeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Console\Command;
use Illuminate\Contracts\Queue\Factory as QueueManager;
use Illuminate\Queue\Console\Concerns\ParsesQueue;
use Illuminate\Queue\Worker;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'queue:resume', aliases: ['queue:continue'])]
Expand Down Expand Up @@ -40,6 +41,12 @@ class ResumeCommand extends Command
*/
public function handle(QueueManager $manager)
{
if (! Worker::$pausable) {
$this->components->error('Worker::$pausable must be set to true to use this command.');

return 1;
}

[$connection, $queue] = $this->parseQueue($this->argument('queue'));

$manager->resume($connection, $queue);
Expand Down
Loading