keboola/retry 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

keboola/retry

最新稳定版本:0.5.1

Composer 安装命令:

composer require keboola/retry

包简介

Library for repeatable and retryable operations

README 文档

README

The library for repeatable and retryable operations.
(Forked from https://github.com/vkartaviy/retry)

Build Status

Here is a simple example:

<?php

use Retry\RetryProxy;
use Retry\Policy\SimpleRetryPolicy;
use Retry\BackOff\ExponentialBackOffPolicy;

$retryPolicy = new SimpleRetryPolicy(3);
$backOffPolicy = new ExponentialBackOffPolicy();

$proxy = new RetryProxy($retryPolicy, $backOffPolicy);
$result = $proxy->call(function() {
    // call external service and return result
});

If you want to supply your own retry decider method you can by using the CallableRetryPolicy

<?php

use Retry\RetryProxy;
use Retry\Policy\SimpleRetryPolicy;
use Retry\BackOff\ExponentialBackOffPolicy;

$retryPolicy = new CallableRetryPolicy(function (\Throwable $e) {
    if ($e->getCode() === 200) {
        return false;
    } 
    return true;
});
$proxy = new RetryProxy($retryPolicy, new ExponentialBackOffPolicy());
$result = $proxy->call(function() {
   // call external service and return result
});

统计信息

  • 总下载量: 103.16k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 12
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 5
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-11