From 0959d8f1346865d4337744244679b8f9870bfbc0 Mon Sep 17 00:00:00 2001 From: smaftoul Date: Mon, 4 Nov 2013 15:14:20 +0100 Subject: [PATCH] Retry on some 5xx errors `composer install` gives me some intermittent 502 errors on github. Composer already does some retries. I think, on 502, 503 and 504, we should retry. --- src/Composer/Downloader/FileDownloader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index 6581b6ca7..c78e65a31 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -120,7 +120,7 @@ class FileDownloader implements DownloaderInterface break; } catch (TransportException $e) { // if we got an http response with a proper code, then requesting again will probably not help, abort - if ((0 !== $e->getCode() && 500 !== $e->getCode()) || !$retries) { + if ((0 !== $e->getCode() && !in_array($e->getCode(),array(500, 502, 503, 504))) || !$retries) { throw $e; } if ($this->io->isVerbose()) {