ThrottlesExceptions
class ThrottlesExceptions
Properties
| protected string|null | $key | The developer specified key that the rate limiter should use. |
|
| protected bool | $byJob | Indicates whether the throttle key should use the job's UUID. |
|
| protected Closure|int | $retryAfterMinutes | The number of minutes to wait before retrying the job after an exception. |
|
| protected ?callable | $reportCallback | The callback that determines if the exception should be reported. |
|
| protected ?callable | $whenCallback | The callback that determines if rate limiting should apply. |
|
| protected callable[] | $deleteWhenCallbacks | The callbacks that determine if the job should be deleted. |
|
| protected callable[] | $failWhenCallbacks | The callbacks that determine if the job should be failed. |
|
| protected string | $prefix | The prefix of the rate limiter key. |
|
| protected | $limiter | The rate limiter instance. |
Methods
Create a new middleware instance.
Process the job.
Specify a callback that should determine if rate limiting behavior should apply.
Add a callback that should determine if the job should be deleted.
Add a callback that should determine if the job should be failed.
Set the prefix of the rate limiter key.
Get the number of seconds that should elapse before the job is retried after an exception.
Get the cache key associated for the rate limiter.
Set the value that the rate limiter should be keyed by.
Indicate that the throttle key should use the job's UUID.
Report exceptions and optionally specify a callback that determines if the exception should be reported.
Get the number of seconds that should elapse before the job is retried.
Details
at line 75
__construct(int $maxAttempts = 10, int $decaySeconds = 600)
Create a new middleware instance.
at line 84
mixed
handle(mixed $job, callable $next)
Process the job.
at line 125
ThrottlesExceptions
when(callable $callback)
Specify a callback that should determine if rate limiting behavior should apply.
at line 135
ThrottlesExceptions
deleteWhen(callable|string $callback)
Add a callback that should determine if the job should be deleted.
at line 147
ThrottlesExceptions
failWhen(callable|string $callback)
Add a callback that should determine if the job should be failed.
at line 159
protected bool
shouldDelete(Throwable $throwable)
Determine if the job should be deleted for the given exception.
at line 173
protected bool
shouldFail(Throwable $throwable)
Determine if the job should be failed for the given exception.
at line 187
ThrottlesExceptions
withPrefix(string $prefix)
Set the prefix of the rate limiter key.
at line 197
ThrottlesExceptions
backoff(Closure|int $backoff)
Specify the number of minutes a job should be delayed when it is released (before it has reached its max exceptions).
at line 207
protected int
getTimeUntilNextRetryAfterException(Throwable $throwable)
Get the number of seconds that should elapse before the job is retried after an exception.
at line 219
protected string
getKey(mixed $job)
Get the cache key associated for the rate limiter.
at line 239
ThrottlesExceptions
by(string $key)
Set the value that the rate limiter should be keyed by.
at line 249
ThrottlesExceptions
byJob()
Indicate that the throttle key should use the job's UUID.
at line 259
ThrottlesExceptions
report(callable|null $callback = null)
Report exceptions and optionally specify a callback that determines if the exception should be reported.
at line 269
protected int
getTimeUntilNextRetry(string $key)
Get the number of seconds that should elapse before the job is retried.