Fix job dispatching

This commit is contained in:
Deon George 2020-07-16 11:49:20 +10:00
parent d21df1c575
commit ed49ef29b5
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254
2 changed files with 5 additions and 5 deletions

View File

@ -9,8 +9,6 @@ use App\Jobs\CatalogVerify as Job;
class CatalogVerify extends Command
{
use DispatchesJobs;
/**
* The name and signature of the console command.
*
@ -44,7 +42,7 @@ class CatalogVerify extends Command
public function handle()
{
if ($this->argument('type')) {
$this->dispatch(new Job($this->argument('type')))->onQueue('scan');
Job::dispatch($this->argument('type'))->onQueue('scan');
} else {
}

View File

@ -2,7 +2,9 @@
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Log;
@ -11,7 +13,7 @@ use App\Traits\Type;
class CatalogVerify extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels, Type;
use Dispatchable, Queueable, InteractsWithQueue, SerializesModels, Type;
// What we should verify
private $type = NULL;
@ -39,7 +41,7 @@ class CatalogVerify extends Job implements ShouldQueue
$good = $bad = $ugly = 0;
$result = $class::select('*')->each(function($o) use ($good,$bad,$ugly) {
$class::select('*')->each(function($o) use ($good,$bad,$ugly) {
if (! file_exists($o->file_name(FALSE))) {
Log::error(sprintf('Media doesnt exist: [%s] (%d:%s)',$this->type,$o->id,$o->file_name(FALSE)));
$bad++;