REDROOM
PHP 8.3.31
Path:
Logout
Edit File
Size: 3.76 KB
Close
/home/getspomw/royalsquad.us/vendor/laravel/framework/src/Illuminate/Queue/Console/MonitorCommand.php
Text
Base64
<?php namespace Illuminate\Queue\Console; use Illuminate\Console\Command; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Queue\Factory; use Illuminate\Queue\Events\QueueBusy; use Illuminate\Support\Collection; use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand(name: 'queue:monitor')] class MonitorCommand extends Command { /** * The console command name. * * @var string */ protected $signature = 'queue:monitor {queues : The names of the queues to monitor} {--max=1000 : The maximum number of jobs that can be on the queue before an event is dispatched}'; /** * The console command description. * * @var string */ protected $description = 'Monitor the size of the specified queues'; /** * The queue manager instance. * * @var \Illuminate\Contracts\Queue\Factory */ protected $manager; /** * The events dispatcher instance. * * @var \Illuminate\Contracts\Events\Dispatcher */ protected $events; /** * Create a new queue monitor command. * * @param \Illuminate\Contracts\Queue\Factory $manager * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function __construct(Factory $manager, Dispatcher $events) { parent::__construct(); $this->manager = $manager; $this->events = $events; } /** * Execute the console command. * * @return void */ public function handle() { $queues = $this->parseQueues($this->argument('queues')); $this->displaySizes($queues); $this->dispatchEvents($queues); } /** * Parse the queues into an array of the connections and queues. * * @param string $queues * @return \Illuminate\Support\Collection */ protected function parseQueues($queues) { return (new Collection(explode(',', $queues)))->map(function ($queue) { [$connection, $queue] = array_pad(explode(':', $queue, 2), 2, null); if (! isset($queue)) { $queue = $connection; $connection = $this->laravel['config']['queue.default']; } return [ 'connection' => $connection, 'queue' => $queue, 'size' => $size = $this->manager->connection($connection)->size($queue), 'status' => $size >= $this->option('max') ? '<fg=yellow;options=bold>ALERT</>' : '<fg=green;options=bold>OK</>', ]; }); } /** * Display the queue sizes in the console. * * @param \Illuminate\Support\Collection $queues * @return void */ protected function displaySizes(Collection $queues) { $this->newLine(); $this->components->twoColumnDetail('<fg=gray>Queue name</>', '<fg=gray>Size / Status</>'); $queues->each(function ($queue) { $name = '['.$queue['connection'].'] '.$queue['queue']; $status = '['.$queue['size'].'] '.$queue['status']; $this->components->twoColumnDetail($name, $status); }); $this->newLine(); } /** * Fire the monitoring events. * * @param \Illuminate\Support\Collection $queues * @return void */ protected function dispatchEvents(Collection $queues) { foreach ($queues as $queue) { if ($queue['status'] == '<fg=green;options=bold>OK</>') { continue; } $this->events->dispatch( new QueueBusy( $queue['connection'], $queue['queue'], $queue['size'], ) ); } } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 15
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
stubs
DIR
-
drwxrwxrwx
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
BatchesTableCommand.php
1.83 KB
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ClearCommand.php
2.73 KB
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FailedTableCommand.php
1.82 KB
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FlushFailedCommand.php
1008 B
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ForgetFailedCommand.php
907 B
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ListenCommand.php
4.08 KB
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ListFailedCommand.php
2.95 KB
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
MonitorCommand.php
3.76 KB
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PruneBatchesCommand.php
1.99 KB
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PruneFailedJobsCommand.php
1.21 KB
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RestartCommand.php
1.26 KB
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RetryBatchCommand.php
2.20 KB
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RetryCommand.php
5.50 KB
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TableCommand.php
1.78 KB
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
WorkCommand.php
12.03 KB
lrw-rw-rw-
2025-09-17 06:52:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).