retry-handler / retry-handler
PHP implementation of retry-handler
Installs: 22 752
Dependents: 0
Suggesters: 0
Security: 0
Stars: 18
Watchers: 1
Forks: 3
Open Issues: 0
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2022-06-13 13:39:21 UTC
README
Retrys any procedure.
Heavily inspired by kimoto/retry-handler
Synopsis
Basic usage
<?php use \RetryHandler\Proc; use \RetryHandler\RetryOverException; $proc = new Proc(function () { // Some procedure may cause error. }); try { // Trys to invoke procedure until it succeeded. $proc->retry(3); } catch (RetryOverException $e) { // 3 times of trial had been failed. }
Wait after failure
Waits specified seconds after a trial failed. 1 second by default.
<?php $proc->retry(3, array('wait' => '5'));
Specify accepted exception
<?php $proc->retry(3, array('accepted_exception' => 'Guzzle\Http\HttpException'));
Author
Yuya Takeyama http://yuyat.jp/