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;
|
||||
|
||||
use Illuminate\Foundation\Queue\Queueable;
|
||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
@ -11,7 +13,7 @@ use App\Models\Abstracted\Catalog;
|
||||
|
||||
class CatalogDelete implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue,SerializesModels;
|
||||
use InteractsWithQueue,Queueable,SerializesModels;
|
||||
|
||||
// Our object
|
||||
private Catalog $o;
|
||||
@ -26,6 +28,19 @@ class CatalogDelete implements ShouldQueue
|
||||
$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.
|
||||
*
|
||||
|
@ -32,7 +32,15 @@ class CatalogMove implements ShouldQueue,ShouldBeUnique
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Models\Abstracted\Catalog;
|
||||
|
||||
class CatalogScan implements ShouldQueue, ShouldBeUnique
|
||||
class CatalogScan implements ShouldQueue,ShouldBeUnique
|
||||
{
|
||||
use InteractsWithQueue,Queueable,SerializesModels;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user