承接 eshta/resilient-task 相关项目开发

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

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

eshta/resilient-task

Composer 安装命令:

composer require eshta/resilient-task

包简介

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.

README 文档

README

Build Status CodeCov Release PHPv Downloads

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.

Usage

Install the eshta/resilient-task package:

$ composer require eshta/resilient-task

Example

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!');
}
  • try 10 times at most
  • maximum sleep time between retries 16 seconds
  • first sleep time is half a second
  • back-off factor [2 default]: double sleeping time after each failed attempt

Note:: the runner will only stop when there is a non-null result returned by the task, or the max tries have been exhausted

Contributing

See CONTRIBUTING and Code of Conduct, if you want to make contribution (pull request) or just build and test project on your own.

Resources

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固