定制 keboola/settle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

keboola/settle

最新稳定版本:1.0.2

Composer 安装命令:

composer require keboola/settle

包简介

Settle provides a function to wait for something to happen.

README 文档

README

Library which provides a function that waits for something to happen. Usage:

use Keboola\Settle\SettleFactory;
use Psr\Log\NullLogger;

$logger = new NullLogger();
$factory = new SettleFactory($logger);

$settle = $factory->createSettle(maxAttempts: 10, maxAttemptsDelay: 1);
$i = 0;
$settle->settle(
    comparator: fn($v) => $v === 5,
    getCurrentValue: function() use (&$i) {while ($i < 5) {$i++; return $i;}},
);

The settle function expects two callbacks - comparator and getCurrentValue. In a typical scenario, the getCurrentValue checks and returns the result of some asynchronous operation (data loaded, process finished) and the comparator checks that the getCurrentValue result is the expected value. If the expected value is not reached within the specified number of attempts a RuntimeException is thrown.

License

MIT licensed, see LICENSE file.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 14
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-21