\Cake\Core\RetryCommandRetry

Allows any action to be retried in case of an exception.

This class can be parametrized with a strategy, which will be followed to determine whether or not the action should be retried.

Summary

Methods
Properties
Constants
__construct()
run()
No public properties found
No constants found
No protected methods found
$strategy
$retries
N/A
No private methods found
No private properties found
N/A

Properties

$retries

$retries : integer

The number of retries to perform in case of failure.

Type

integer

Methods

__construct()

__construct(\Cake\Core\Retry\RetryStrategyInterface  $strategy, integer  $retries = 1) 

Creates the CommandRetry object with the given strategy and retry count

Parameters

\Cake\Core\Retry\RetryStrategyInterface $strategy

The strategy to follow should the action fail

integer $retries

The number of times the action has been already called

run()

run(callable  $action) : mixed

The number of retries to perform in case of failure

Parameters

callable $action

The callable action to execute with a retry strategy

Throws

\Exception

Returns

mixed —

The return value of the passed action callable