承接 borisguery/transient-error-handling 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

borisguery/transient-error-handling

最新稳定版本:0.5

Composer 安装命令:

composer require borisguery/transient-error-handling

包简介

Transient Error Handling

README 文档

README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Provide a way to easily retry actions on transient errors / exceptions such as a network failure.

Install

Via Composer

$ composer require borisguery/transient-error-handling

Usage

use Bgy\TransientFaultHandling\RetryStrategies\FixedInterval;
use Bgy\TransientFaultHandling\RetryPolicy;
use Bgy\TransientFaultHandling\ErrorDetectionStrategies\TransientErrorCatchAllStrategy;

$retryCount = 10;
$retryIntervalInMicroseconds = 1000000 // 1 sec 
$retryStrategy = new FixedInterval($retryCount, $retryIntervalInMicroseconds);
$errorDetectionStrategy = new TransientErrorCatchAllStrategy(); // You may want to implement your own

$retryPolicy = new RetryPolicy($errorDetectionStrategy, $retryStrategy);
$retryPolicy->execute(function() {
    // try to connect to MySQL
    throw new ConnectionError("Unable to connect to MySQL");
});

// This configuration will try to execute 10 times the function everyseconds if an exception is thrown. 

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-12