diff --git a/app/Console/Commands/PacketProcess.php b/app/Console/Commands/PacketProcess.php index 9e66f17..a19f285 100644 --- a/app/Console/Commands/PacketProcess.php +++ b/app/Console/Commands/PacketProcess.php @@ -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')); } } }