Updates to Jobs so they are all queable, and overlapping is consistent
This commit is contained in:
parent
4828cc6e84
commit
a2c71afa73
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Jobs;
|
namespace App\Jobs;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Queue\Queueable;
|
||||||
|
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
@ -11,7 +13,7 @@ use App\Models\Abstracted\Catalog;
|
|||||||
|
|
||||||
class CatalogDelete implements ShouldQueue
|
class CatalogDelete implements ShouldQueue
|
||||||
{
|
{
|
||||||
use InteractsWithQueue,SerializesModels;
|
use InteractsWithQueue,Queueable,SerializesModels;
|
||||||
|
|
||||||
// Our object
|
// Our object
|
||||||
private Catalog $o;
|
private Catalog $o;
|
||||||
@ -26,6 +28,19 @@ class CatalogDelete implements ShouldQueue
|
|||||||
$this->o = $o;
|
$this->o = $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function middleware(): array
|
||||||
|
{
|
||||||
|
return [new WithoutOverlapping($this->uniqueId())];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the unique ID for the job.
|
||||||
|
*/
|
||||||
|
public function uniqueId(): string
|
||||||
|
{
|
||||||
|
return $this->o::config.'|'.$this->o->id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the job.
|
* Execute the job.
|
||||||
*
|
*
|
||||||
|
@ -32,7 +32,15 @@ class CatalogMove implements ShouldQueue,ShouldBeUnique
|
|||||||
|
|
||||||
public function middleware(): array
|
public function middleware(): array
|
||||||
{
|
{
|
||||||
return [new WithoutOverlapping($this->o::config.'|'.$this->o->id)];
|
return [new WithoutOverlapping($this->uniqueId())];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the unique ID for the job.
|
||||||
|
*/
|
||||||
|
public function uniqueId(): string
|
||||||
|
{
|
||||||
|
return $this->o::config.'|'.$this->o->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user