Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 47 | All time: 10,774 This week: 660![]() |
Version | License | PHP version | Categories | |||
resilient-task 1.0 | Custom (specified... | 5 | PHP 5, Language |
Description | Author | ||||||||||||||
This class can be used to run a task and retry while it fails for a period. |
|
Resilient Task Runner, A circuit breaker implementation, highly configurable task runner with number of max retries, back-off factor, maximum sleep time, and starting sleep time.
Install the `
eshta/resilient-task`
package:
$ composer require eshta/resilient-task
use GuzzleHttp\Exception\ConnectException;
$task = function() {
try {
$response = $client->request('GET', 'https://github.com/_abc_123_404');
return $response;
} catch (ConnectException $e) {
echo Psr7\str($e->getRequest());
}
};
$runner = new ResilientTaskRunner(10, 16, 0.5);
$response = $runner->run($task);
if (is_null($response)) {
throw new MyFavouriteException('Service call failed!');
}
Note:: the runner will only stop when there is a non-null result returned by the task, or the max tries have been exhausted
See CONTRIBUTING and Code of Conduct, if you want to make contribution (pull request) or just build and test project on your own.
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | License text | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation |
![]() |
/ | src |
File | Role | Description |
---|---|---|
![]() |
Class | Class source |
![]() |
Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.