Explorar o código

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.
smaftoul %!s(int64=11) %!d(string=hai) anos
pai
achega
0959d8f134
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/Composer/Downloader/FileDownloader.php

+ 1 - 1
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()) {