/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/cakephp/src/Core/Retry
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/cakephp/src/Core/Retry/CommandRetry.php (2580B)
strategy = $strategy;
$this->maxRetries = $maxRetries;
}
/**
* The number of retries to perform in case of failure
*
* @param callable $action The callable action to execute with a retry strategy
* @return mixed The return value of the passed action callable
* @throws \Exception
*/
public function run(callable $action)
{
$this->numRetries = 0;
while (true) {
try {
return $action();
} catch (Exception $e) {
if (
$this->numRetries < $this->maxRetries &&
$this->strategy->shouldRetry($e, $this->numRetries)
) {
$this->numRetries++;
continue;
}
throw $e;
}
}
}
/**
* Returns the last number of retry attemps.
*
* @return int
*/
public function getRetries(): int
{
return $this->numRetries;
}
}