Don't allow NodeStatisticsJob to be in the queue multiple times (#664)

* Make job unique

* Pint fix
This commit is contained in:
Lance Pioch 2024-10-26 18:53:32 -04:00 committed by GitHub
parent ecb195b2c4
commit 1df3e8d5b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,26 +4,16 @@ namespace App\Jobs;
use App\Models\Node;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class NodeStatistics implements ShouldQueue
class NodeStatistics implements ShouldBeUnique, ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct()
{
//
}
/**
* Execute the job.
*/
public function handle(): void
{
foreach (Node::all() as $node) {