/** @internal */ public static function _applyRetryConfig($value, array &$args, HandlerList $list) { if (!$value) { return; } $list->appendSign(Middleware::retry(RetryMiddleware::createDefaultDecider($value), function ($retries) { return $retries ? RetryMiddleware::exponentialDelay($retries) / 2 : 0; }, isset($args['stats']['retries']) ? (bool) $args['stats']['retries'] : false), 'retry'); }
/** @internal */ public static function _applyRetryConfig($value, $_, HandlerList $list) { if (!$value) { return; } $decider = RetryMiddleware::createDefaultDecider($value); $decider = function ($retries, $command, $request, $result, $error) use($decider, $value) { $maxRetries = null !== $command['@retries'] ? $command['@retries'] : $value; if ($decider($retries, $command, $request, $result, $error)) { return true; } elseif ($error instanceof AwsException && $retries < $maxRetries) { if ($error->getResponse() && $error->getResponse()->getStatusCode() >= 400) { return strpos($error->getResponse()->getBody(), 'Your socket connection to the server') !== false; } elseif ($error->getPrevious() instanceof RequestException) { // All commands except CompleteMultipartUpload are // idempotent and may be retried without worry if a // networking error has occurred. return $command->getName() !== 'CompleteMultipartUpload'; } } return false; }; $delay = [RetryMiddleware::class, 'exponentialDelay']; $list->appendSign(Middleware::retry($decider, $delay), 'retry'); }
public static function _apply_retries($value, array &$args, HandlerList $list) { if ($value) { $decider = RetryMiddleware::createDefaultDecider($value); $list->appendSign(Middleware::retry($decider, null, $args['stats']['retries']), 'retry'); } }