true, 'Throttling' => true, 'ThrottlingException' => true, 'ProvisionedThroughputExceededException' => true, 'RequestThrottled' => true, ); /** * @var ExceptionParserInterface Exception parser used to parse exception responses */ protected $exceptionParser; public function __construct(ExceptionParserInterface $exceptionParser, BackoffStrategyInterface $next = null) { $this->exceptionParser = $exceptionParser; if ($next) { $this->setNext($next); } } /** * {@inheritdoc} */ public function makesDecision() { return true; } /** * {@inheritdoc} */ protected function getDelay( $retries, RequestInterface $request, Response $response = null, HttpException $e = null ) { if ($response && $response->isClientError()) { $parts = $this->exceptionParser->parse($request, $response); return isset(self::$throttlingExceptions[$parts['code']]) ? true : null; } } }