tony-sol/retryer

简单的重试器

v1.1.1 2023-02-02 11:57 UTC

This package is auto-updated.

Last update: 2024-09-29 08:28:48 UTC


README

简单的重试器

用法

	$result = (new \Retryer\Retryer())
		/** @var callable $action Execute some action */
		->do($action)
		/** @var int $N N times, 1 by default */
		->times($N)
		/** @var int $T with delay T ms between iterations, 0 by default */
		->withDelay($T)
		/** @var bool $isOn = true use exponential backoff between iterations */
		->useExponentialBackoff($isOn) //
		/** @var float $M use linear backoff M multiplier */
		->useLinearBackoffMultiplier($M) //
		/** @note use can use only linear or exponential backoff, by default backoff is constant and equals to T */
		/** @var string[] $exceptions Array of exceptions' FQCN which may interrupt execution */
		->withBreakingExceptions($exceptions)
		/** @note throw exception on last try if failed */
		->throwExceptionOnLastTry()
		->execute();

免责声明

所有信息和源代码均以原样提供,不提供任何明示或暗示的保证。使用源代码或其部分完全由您自行决定,并承担所有风险。Citymobil LLC采取了合理的措施确保该存储库中发布的信息的相关性,但不对维护或更新该存储库或其部分承担责任,除非公司独立地、未通知第三方设定框架。

所有信息和源代码均以原始形式提供,不提供任何明确或隐含的保证。使用源代码或其部分完全由您自行决定,并承担所有风险。公司“Citymobil”LLC采取合理措施确保存储库中发布的信息的准确性,但不承担维护或更新该存储库或其部分的责任,除非公司自行设定框架,且未通知第三方。