Skip to content

Commit b2c8b28

Browse files
authored
[Feature] Implement middleware to prevent overlapping execution of "RunSpeedtestJob" (alexjustesen#1952)
1 parent 7dc54e1 commit b2c8b28

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

app/Jobs/Ookla/RunSpeedtestJob.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Illuminate\Bus\Batchable;
1111
use Illuminate\Contracts\Queue\ShouldQueue;
1212
use Illuminate\Foundation\Queue\Queueable;
13+
use Illuminate\Queue\Middleware\WithoutOverlapping;
1314
use Illuminate\Support\Arr;
1415
use Symfony\Component\Process\Exception\ProcessFailedException;
1516
use Symfony\Component\Process\Process;
@@ -32,6 +33,16 @@ public function __construct(
3233
public Result $result,
3334
) {}
3435

36+
/**
37+
* Get the middleware the job should pass through.
38+
*
39+
* @return array<int, object>
40+
*/
41+
public function middleware(): array
42+
{
43+
return [new WithoutOverlapping('run-speedtest')];
44+
}
45+
3546
/**
3647
* Execute the job.
3748
*/

0 commit comments

Comments
 (0)