protected static function getRetryDelay($retries, AbstractTransferEvent $event, $headerName) { if (is_null($event->getResponse()) || !$event->getResponse()->hasHeader($headerName)) { return RetrySubscriber::exponentialDelay($retries, $event); } $retryAfter = $event->getResponse()->getHeader($headerName); if (is_numeric($retryAfter)) { if ($retryAfter < time() - strtotime('1 day', 0)) { return $retryAfter; } else { return $retryAfter - time(); } } if (Utils::isValidDateTimeString($retryAfter, DATE_RFC1123)) { $date = \DateTime::createFromFormat(DATE_RFC1123, $retryAfter); return $date->getTimestamp() - time(); } return RetrySubscriber::exponentialDelay($retries, $event); }