File tree Expand file tree Collapse file tree 6 files changed +60
-23
lines changed
Expand file tree Collapse file tree 6 files changed +60
-23
lines changed Original file line number Diff line number Diff line change 1010use Illuminate \Bus \Batchable ;
1111use Illuminate \Contracts \Queue \ShouldQueue ;
1212use Illuminate \Foundation \Queue \Queueable ;
13+ use Illuminate \Queue \Middleware \SkipIfBatchCancelled ;
1314
1415class CheckForInternetConnectionJob implements ShouldQueue
1516{
@@ -22,15 +23,21 @@ public function __construct(
2223 public Result $ result ,
2324 ) {}
2425
26+ /**
27+ * Get the middleware the job should pass through.
28+ */
29+ public function middleware (): array
30+ {
31+ return [
32+ new SkipIfBatchCancelled ,
33+ ];
34+ }
35+
2536 /**
2637 * Execute the job.
2738 */
2839 public function handle (): void
2940 {
30- if ($ this ->batch ()->cancelled ()) {
31- return ;
32- }
33-
3441 $ this ->result ->update ([
3542 'status ' => ResultStatus::Checking,
3643 ]);
Original file line number Diff line number Diff line change 1010use Illuminate \Bus \Batchable ;
1111use Illuminate \Contracts \Queue \ShouldQueue ;
1212use Illuminate \Foundation \Queue \Queueable ;
13+ use Illuminate \Queue \Middleware \SkipIfBatchCancelled ;
1314use Illuminate \Support \Arr ;
1415
1516class BenchmarkSpeedtestJob implements ShouldQueue
@@ -25,14 +26,24 @@ public function __construct(
2526 public Result $ result ,
2627 ) {}
2728
29+ /**
30+ * Get the middleware the job should pass through.
31+ */
32+ public function middleware (): array
33+ {
34+ return [
35+ new SkipIfBatchCancelled ,
36+ ];
37+ }
38+
2839 /**
2940 * Execute the job.
3041 */
3142 public function handle (): void
3243 {
3344 $ settings = app (ThresholdSettings::class);
3445
35- if ($ this -> batch ()-> cancelled () || $ settings ->absolute_enabled == false ) {
46+ if ($ settings ->absolute_enabled == false ) {
3647 return ;
3748 }
3849
Original file line number Diff line number Diff line change 88use Illuminate \Bus \Batchable ;
99use Illuminate \Contracts \Queue \ShouldQueue ;
1010use Illuminate \Foundation \Queue \Queueable ;
11+ use Illuminate \Queue \Middleware \SkipIfBatchCancelled ;
1112
1213class CompleteSpeedtestJob implements ShouldQueue
1314{
@@ -20,15 +21,21 @@ public function __construct(
2021 public Result $ result ,
2122 ) {}
2223
24+ /**
25+ * Get the middleware the job should pass through.
26+ */
27+ public function middleware (): array
28+ {
29+ return [
30+ new SkipIfBatchCancelled ,
31+ ];
32+ }
33+
2334 /**
2435 * Execute the job.
2536 */
2637 public function handle (): void
2738 {
28- if ($ this ->batch ()->cancelled ()) {
29- return ;
30- }
31-
3239 $ this ->result ->update ([
3340 'status ' => ResultStatus::Completed,
3441 ]);
Original file line number Diff line number Diff line change 1010use Illuminate \Bus \Batchable ;
1111use Illuminate \Contracts \Queue \ShouldQueue ;
1212use Illuminate \Foundation \Queue \Queueable ;
13- use Illuminate \Queue \Middleware \WithoutOverlapping ;
13+ use Illuminate \Queue \Middleware \SkipIfBatchCancelled ;
1414use Illuminate \Support \Arr ;
1515use Symfony \Component \Process \Exception \ProcessFailedException ;
1616use Symfony \Component \Process \Process ;
@@ -40,18 +40,16 @@ public function __construct(
4040 */
4141 public function middleware (): array
4242 {
43- return [new WithoutOverlapping ('run-speedtest ' )];
43+ return [
44+ new SkipIfBatchCancelled ,
45+ ];
4446 }
4547
4648 /**
4749 * Execute the job.
4850 */
4951 public function handle (): void
5052 {
51- if ($ this ->batch ()->cancelled ()) {
52- return ;
53- }
54-
5553 $ this ->result ->update ([
5654 'status ' => ResultStatus::Running,
5755 ]);
Original file line number Diff line number Diff line change 66use Illuminate \Bus \Batchable ;
77use Illuminate \Contracts \Queue \ShouldQueue ;
88use Illuminate \Foundation \Queue \Queueable ;
9+ use Illuminate \Queue \Middleware \SkipIfBatchCancelled ;
910use Illuminate \Support \Arr ;
1011use Illuminate \Support \Facades \Log ;
1112use Symfony \Component \Process \Exception \ProcessFailedException ;
@@ -22,15 +23,21 @@ public function __construct(
2223 public Result $ result ,
2324 ) {}
2425
26+ /**
27+ * Get the middleware the job should pass through.
28+ */
29+ public function middleware (): array
30+ {
31+ return [
32+ new SkipIfBatchCancelled ,
33+ ];
34+ }
35+
2536 /**
2637 * Execute the job.
2738 */
2839 public function handle (): void
2940 {
30- if ($ this ->batch ()->cancelled ()) {
31- return ;
32- }
33-
3441 // If the server id is already set, we don't need to do anything.
3542 if (Arr::get ($ this ->result ->data , 'server.id ' )) {
3643 return ;
Original file line number Diff line number Diff line change 1010use Illuminate \Bus \Batchable ;
1111use Illuminate \Contracts \Queue \ShouldQueue ;
1212use Illuminate \Foundation \Queue \Queueable ;
13+ use Illuminate \Queue \Middleware \SkipIfBatchCancelled ;
1314
1415class SkipSpeedtestJob implements ShouldQueue
1516{
@@ -22,15 +23,21 @@ public function __construct(
2223 public Result $ result ,
2324 ) {}
2425
26+ /**
27+ * Get the middleware the job should pass through.
28+ */
29+ public function middleware (): array
30+ {
31+ return [
32+ new SkipIfBatchCancelled ,
33+ ];
34+ }
35+
2536 /**
2637 * Execute the job.
2738 */
2839 public function handle (): void
2940 {
30- if ($ this ->batch ()->cancelled ()) {
31- return ;
32- }
33-
3441 /**
3542 * Only skip IPs for scheduled tests.
3643 */
You can’t perform that action at this time.
0 commit comments