Added system polling
This commit is contained in:
@@ -34,14 +34,14 @@ class CommBinkpSend extends Command
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
Log::info('CBS:- Call BINKP send');
|
||||
|
||||
$mo = Mailer::where('name',self::ID)->singleOrFail();
|
||||
|
||||
$ao = Address::findFTN($this->argument('ftn'));
|
||||
if (! $ao)
|
||||
throw new ModelNotFoundException('Unknown node: '.$this->argument('ftn'));
|
||||
|
||||
Job::dispatchSync($ao,$mo);
|
||||
Log::info(sprintf('CBS:- Call BINKP send for %s',$ao->ftn));
|
||||
|
||||
$mo = Mailer::where('name',self::ID)->singleOrFail();
|
||||
|
||||
Job::dispatch($ao,$mo);
|
||||
}
|
||||
}
|
||||
|
@@ -34,14 +34,14 @@ class CommEMSISend extends Command
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
Log::info('CES:- Call EMSI send');
|
||||
|
||||
$mo = Mailer::where('name',self::ID)->singleOrFail();
|
||||
|
||||
$ao = Address::findFTN($this->argument('ftn'));
|
||||
if (! $ao)
|
||||
throw new ModelNotFoundException('Unknown node: '.$this->argument('ftn'));
|
||||
|
||||
Job::dispatchSync($ao,$mo);
|
||||
Log::info(sprintf('CES:- Call EMSI send for %s',$ao->ftn));
|
||||
|
||||
$mo = Mailer::where('name',self::ID)->singleOrFail();
|
||||
|
||||
Job::dispatch($ao,$mo);
|
||||
}
|
||||
}
|
||||
|
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 ?: '-',
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
52
app/Console/Commands/MailSend.php
Normal file
52
app/Console/Commands/MailSend.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Jobs\MailSend as Job;
|
||||
|
||||
class MailSend extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'mail:send'
|
||||
.' {--T|type=normal : Send crash, normal or both mail}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Trigger a poll to each node with mail queued';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
switch ($this->option('type')) {
|
||||
case 'crash':
|
||||
Log::info('CML:- Triggering polls to send CRASH mail');
|
||||
Job::dispatchSync(TRUE);
|
||||
break;
|
||||
|
||||
case 'normal':
|
||||
Log::info('CML:- Triggering polls to send NORMAL mail');
|
||||
Job::dispatchSync(FALSE);
|
||||
break;
|
||||
|
||||
case 'all':
|
||||
Log::info('CML:- Triggering polls to send ALL mail');
|
||||
Job::dispatchSync(NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->error('Specify -T crash, normal or all');
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use App\Jobs\MailSend;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
@@ -24,8 +25,8 @@ class Kernel extends ConsoleKernel
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')
|
||||
// ->hourly();
|
||||
$schedule->job(new MailSend(TRUE))->everyFiveMinutes()->withoutOverlapping();
|
||||
$schedule->job(new MailSend(FALSE))->twiceDaily(1,13);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user