Download the PHP package graze/transient-fault-handler without Composer
On this page you can find all versions of the php package graze/transient-fault-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download graze/transient-fault-handler
More information about graze/transient-fault-handler
Files in graze/transient-fault-handler
Package transient-fault-handler
Short Description Retry tasks that fail due to transient faults
License MIT
Homepage https://github.com/graze/transient-fault-handler
Informations about the package transient-fault-handler
Transient Fault Handler
Retries tasks that fail due to transient errors. Well suited to network requests but can retry any callable.
Install
Via Composer
Usage
The transient fault handler takes two detection strategies and a retry strategy. The builder can be used to quickly create a handler.
Detection Strategy
When a task is tried, it will either return some value or throw an exception.
The detection strategies will decide if that value/exception indicates a transient error or not.
If it does, then the fault handler will be told to retry the task. if it does not, then the value/exception either indicates a success or a non-transient error that retrying wouldn't solve.
In these cases, the value is returned to the caller or the exception is rethrown.
FalseyReturnValueDetectionStrategy
: treats return values that evaluate to false as transient.StaticDetectionStrategy
: returns a static value set when constructing the strategy, regardless of the return value or exception.
Retry Strategy
If the detection strategy decides that the task should be retried, the retry strategy will decide how long to wait before doing so (the backoff period), and optionally impose a maximum number of retries on the task.
ExponentialBackoffStrategy
: the backoff period is chosen randomly between zero and an exponentially increasing maximum.
Builder
The builder makes it easier to create a fault handler by automatically injecting dependencies. The default strategies that the builder uses can be overridden by using the setters.
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Jake Wright
- All Contributors
License
The MIT License (MIT). Please see License File for more information.