Skip to content

Commit

Permalink
Update Queues docs to include dontRelease() on RateLimited middle…
Browse files Browse the repository at this point in the history
…ware (laravel#7247)

* Update Queues documentation to include `dontRelease()` on `RateLimited` middleware

This adds a section to the `RateLimited` middleware docs to mention the `dontRelease()` method (similar to how it is mentioned in the following `WithoutOverlapping` middleware section).

* Update queues.md

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
totov and taylorotwell authored Aug 22, 2021
1 parent bb0f1ff commit 526abde
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions queues.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,18 @@ Once you have defined your rate limit, you may attach the rate limiter to your b

Releasing a rate limited job back onto the queue will still increment the job's total number of `attempts`. You may wish to tune your `tries` and `maxExceptions` properties on your job class accordingly. Or, you may wish to use the [`retryUntil` method](#time-based-attempts) to define the amount of time until the job should no longer be attempted.

If you do not want a job to be retried when it is rate limited, you may use the `dontRelease` method:

/**
* Get the middleware the job should pass through.
*
* @return array
*/
public function middleware()
{
return [(new RateLimited('backups'))->dontRelease()];
}

> {tip} If you are using Redis, you may use the `Illuminate\Queue\Middleware\RateLimitedWithRedis` middleware, which is fine-tuned for Redis and more efficient than the basic rate limiting middleware.
<a name="preventing-job-overlaps"></a>
Expand Down

0 comments on commit 526abde

Please sign in to comment.