/** @internal */ public static function _applyRetryConfig($value, array &$args, HandlerList $list) { if (!$value) { return; } $list->appendSign(Middleware::retry(RetryMiddleware::createDefaultDecider($value), function ($retries) { return $retries ? 50 * (int) pow(2, $retries - 1) / 1000 : 0; }), 'retry'); }
/** @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'); }
private function addSignatureMiddleware() { $api = $this->getApi(); $provider = $this->signatureProvider; $version = $this->config['signature_version']; $name = $this->config['signing_name']; $region = $this->config['signing_region']; $resolver = static function (CommandInterface $c) use($api, $provider, $name, $region, $version) { if ('none' === $api->getOperation($c->getName())['authtype']) { $version = 'anonymous'; } return SignatureProvider::resolve($provider, $version, $name, $region); }; $this->handlerList->appendSign(Middleware::signer($this->credentialProvider, $resolver), 'signer'); }
/** @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'); }
/** @internal */ public static function _applyRetryConfig($value, $_, HandlerList $list) { if (!$value) { return; } $decider = RetryMiddleware::createDefaultDecider($value); $decider = function ($retries, $request, $result, $error) use($decider) { if ($decider($retries, $request, $result, $error)) { return true; } elseif ($error instanceof AwsException) { return $error->getResponse() && strpos($error->getResponse()->getBody(), 'Your socket connection to the server') !== false; } 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), 'retry'); } }
private function addSignatureMiddleware() { // Sign requests. This may need to be modified later to support // variable signatures per/operation. $this->handlerList->appendSign(Middleware::signer($this->credentialProvider, constantly(SignatureProvider::resolve($this->signatureProvider, $this->config['signature_version'], $this->api->getSigningName(), $this->region))), 'signer'); }