retry-handler/retry-handler

This package is abandoned and no longer maintained. No replacement package was suggested.

PHP implementation of retry-handler

v0.0.0 2012-03-19 16:04 UTC

This package is auto-updated.

Last update: 2022-06-13 13:39:21 UTC


README

master: Build Status develop: Build Status

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/