clrghouz/app/Console/Commands/JobList.php
Deon George f13d3396ce
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 40s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m41s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
Update job:list, and change "subject" to "jobname"
2024-05-21 21:11:10 +10:00

49 lines
930 B
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Job;
class JobList extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'job:list';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Detail list of items in the queue';
/**
* Execute the console command.
*/
public function handle()
{
$lastq = NULL;
foreach (Job::orderBy('queue')->orderBy('created_at')->cursor() as $o) {
if ($o->queue !== $lastq) {
$this->alert(sprintf('Queue: %s',$o->queue));
$lastq = $o->queue;
}
$this->info(sprintf('%s-%d: %s[%s] - %d/%d tries [Next:%s]%s',
$o->uuid,
$o->id,
$o->display_name,
$o->command->jobname,
$o->attempts,$o->maxTries,
$o->available_at ?: '-',
$o->attempts ? sprintf(' (Created:%s)',$o->created_at) : ''
));
}
}
}