From 1df3e8d5b0f10c1d38153e4eedc80a3458922f09 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Sat, 26 Oct 2024 18:53:32 -0400 Subject: [PATCH] Don't allow NodeStatisticsJob to be in the queue multiple times (#664) * Make job unique * Pint fix --- app/Jobs/NodeStatistics.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/app/Jobs/NodeStatistics.php b/app/Jobs/NodeStatistics.php index 9546f0ba0..d6815ce6c 100644 --- a/app/Jobs/NodeStatistics.php +++ b/app/Jobs/NodeStatistics.php @@ -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) {