Add a dontqueue option to packet::process

This commit is contained in:
Deon George 2023-11-22 12:15:48 +11:00
parent 116f726885
commit e8f4bf93bd
1 changed files with 8 additions and 6 deletions

View File

@ -21,7 +21,8 @@ class PacketProcess extends Command
protected $signature = 'packet:process'
.' {file : Packet to process}'
.' {--N|nobot : Dont process bots}'
.' {ftn? : System the packet is from}';
.' {ftn? : System the packet is from}'
.' {--Q|dontqueue : Dont queue the message}';
/**
* The console command description.
@ -33,19 +34,17 @@ class PacketProcess extends Command
/**
* Execute the console command.
*
* @return mixed
* @return void
* @throws \App\Classes\FTN\InvalidPacketException
* @todo Should this just call PacketProcess instead?
*/
public function handle()
{
$fs = Storage::disk(config('fido.local_disk'));
$rel_name = sprintf('%s/%s',config('fido.dir'),$this->argument('file'));
$a = NULL;
$f = new File($fs->path($rel_name));
$m = NULL;
$m = [];
if ($this->argument('ftn')) {
$a = Address::findFTN($this->argument('ftn'));
@ -63,7 +62,10 @@ class PacketProcess extends Command
$this->info(sprintf('Processing message from [%s] with msgid [%s] in (%s)',$msg->fboss,$msg->msgid,$f->pktName()));
// Dispatch job.
Job::dispatch($msg,$f->pktName(),$a,$pkt->fftn_o,Carbon::now(),$this->option('nobot'));
if ($this->option('dontqueue'))
Job::dispatchSync($msg,$f->pktName(),$a,$pkt->fftn_o,Carbon::now(),$this->option('nobot'));
else
Job::dispatch($msg,$f->pktName(),$a,$pkt->fftn_o,Carbon::now(),$this->option('nobot'));
}
}
}