netlogix/retry
最新稳定版本:1.0.0
Composer 安装命令:
composer require netlogix/retry
包简介
Retries a specific PHP code fragment.
README 文档
README
Retries a specific PHP code fragment (called a "task") as long as the "when"
condition evaluates to true.
(new \Netlogix\Retry\Retry()) ->when(condition: fn(int $incarnation) => $incarnation < PHP_INT_MAX) ->task(subject: fn () => throw new \RuntimeException('false'));
There is a shorthand method for counting retries and sleeping between attempts with increasing intervals.
(new \Netlogix\Retry\Retry()) /** * http://backoffcalculator.com/?attempts=5&rate=1&interval=0.5 * = (0.5 + 1 + 1.5 + 2.0 + 2.5) seconds * = 7.5 seconds */ ->withExponentialBackoff(retryInterval: 0.5, maxRetries: 5) ->onExceptionsOfType(\Doctrine\DBAL\Exception\DeadlockException::class) ->task(fn () => $dbal->executeQuery($statement));
统计信息
- 总下载量: 44.6k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-05