Fix job dispatching
This commit is contained in:
parent
d21df1c575
commit
ed49ef29b5
@ -9,8 +9,6 @@ use App\Jobs\CatalogVerify as Job;
|
|||||||
|
|
||||||
class CatalogVerify extends Command
|
class CatalogVerify extends Command
|
||||||
{
|
{
|
||||||
use DispatchesJobs;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name and signature of the console command.
|
* The name and signature of the console command.
|
||||||
*
|
*
|
||||||
@ -44,7 +42,7 @@ class CatalogVerify extends Command
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
if ($this->argument('type')) {
|
if ($this->argument('type')) {
|
||||||
$this->dispatch(new Job($this->argument('type')))->onQueue('scan');
|
Job::dispatch($this->argument('type'))->onQueue('scan');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Jobs;
|
namespace App\Jobs;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
@ -11,7 +13,7 @@ use App\Traits\Type;
|
|||||||
|
|
||||||
class CatalogVerify extends Job implements ShouldQueue
|
class CatalogVerify extends Job implements ShouldQueue
|
||||||
{
|
{
|
||||||
use InteractsWithQueue, SerializesModels, Type;
|
use Dispatchable, Queueable, InteractsWithQueue, SerializesModels, Type;
|
||||||
|
|
||||||
// What we should verify
|
// What we should verify
|
||||||
private $type = NULL;
|
private $type = NULL;
|
||||||
@ -39,7 +41,7 @@ class CatalogVerify extends Job implements ShouldQueue
|
|||||||
|
|
||||||
$good = $bad = $ugly = 0;
|
$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))) {
|
if (! file_exists($o->file_name(FALSE))) {
|
||||||
Log::error(sprintf('Media doesnt exist: [%s] (%d:%s)',$this->type,$o->id,$o->file_name(FALSE)));
|
Log::error(sprintf('Media doesnt exist: [%s] (%d:%s)',$this->type,$o->id,$o->file_name(FALSE)));
|
||||||
$bad++;
|
$bad++;
|
||||||
|
Loading…
Reference in New Issue
Block a user