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 Throwable): int|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 string|null | $storeName | The rate limiter store that should be used. |
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.
Specify the rate limiter store that should be used.
Get the number of seconds that should elapse before the job is retried after an exception.
Get the key associated with 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.
Details
at line 80
__construct(int $maxAttempts = 10, int $decaySeconds = 600)
Create a new middleware instance.
at line 91
mixed
handle(mixed $job, callable $next)
Process the job.
at line 145
ThrottlesExceptions
when(callable $callback)
Specify a callback that should determine if rate limiting behavior should apply.
at line 155
ThrottlesExceptions
deleteWhen(callable|string $callback)
Add a callback that should determine if the job should be deleted.
at line 167
ThrottlesExceptions
failWhen(callable|string $callback)
Add a callback that should determine if the job should be failed.
at line 179
protected bool
shouldDelete(Throwable $throwable)
Determine if the job should be deleted for the given exception.
at line 194
protected bool
shouldFail(Throwable $throwable)
Determine if the job should be failed for the given exception.
at line 209
ThrottlesExceptions
withPrefix(string $prefix)
Set the prefix of the rate limiter key.
at line 221
ThrottlesExceptions
store(UnitEnum|string $store)
Specify the rate limiter store that should be used.
at line 233
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 243
protected int
getTimeUntilNextRetryAfterException(Throwable $throwable)
Get the number of seconds that should elapse before the job is retried after an exception.
at line 255
protected string
getKey(mixed $job)
Get the key associated with the rate limiter.
at line 275
ThrottlesExceptions
by(string $key)
Set the value that the rate limiter should be keyed by.
at line 285
ThrottlesExceptions
byJob()
Indicate that the throttle key should use the job's UUID.
at line 295
ThrottlesExceptions
report(callable|null $callback = null)
Report exceptions and optionally specify a callback that determines if the exception should be reported.