Skip to content

Commit

Permalink
add: overlap protection to announce job
Browse files Browse the repository at this point in the history
  • Loading branch information
HDVinnie committed Nov 8, 2021
1 parent 7620347 commit 2b604ad
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/Jobs/ProcessStartedAnnounceRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\Middleware\WithoutOverlapping;

class ProcessStartedAnnounceRequest implements ShouldQueue
{
Expand All @@ -39,6 +40,16 @@ public function __construct(protected $queries, protected User $user, protected
{
}

/**
* Get the middleware the job should pass through.
*
* @return array
*/
public function middleware()
{
return [new WithoutOverlapping($this->user->id.'.'.$this->queries['info_hash'])];
}

/**
* Execute the job.
*
Expand Down

0 comments on commit 2b604ad

Please sign in to comment.