Added system polling
This commit is contained in:
50
app/Console/Commands/JobList.php
Normal file
50
app/Console/Commands/JobList.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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 tries (Created: %s,Timeout: %s,Next: %s)',
|
||||
$o->uuid,
|
||||
$o->id,
|
||||
$o->display_name,
|
||||
$o->command->subject,
|
||||
$o->attempts,
|
||||
$o->created_at,
|
||||
$o->retry_until ?: '-',
|
||||
$o->reserved_at ?: '-',
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user