From bbf959ac34b24291cc699415c7ad2a4eabd5266a Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 20 Jul 2015 17:44:03 +0100 Subject: [PATCH] Do not retry failures once degraded mode is already enabled --- src/Composer/Util/RemoteFilesystem.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index ce30b83a7..edcc465c7 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -191,7 +191,7 @@ class RemoteFilesystem } restore_error_handler(); if (isset($e) && !$this->retry) { - if (false !== strpos($e->getMessage(), 'Operation timed out')) { + if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) { $this->degradedMode = true; $this->io->writeError(array( ''.$e->getMessage().'', @@ -244,6 +244,10 @@ class RemoteFilesystem throw new TransportException('Failed to decode zlib stream'); } } catch (\Exception $e) { + if ($this->degradedMode) { + throw $e; + } + $this->degradedMode = true; $this->io->writeError(array( 'Failed to decode response: '.$e->getMessage().'', @@ -293,7 +297,7 @@ class RemoteFilesystem $e->setHeaders($http_response_header); } - if (false !== strpos($e->getMessage(), 'Operation timed out')) { + if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) { $this->degradedMode = true; $this->io->writeError(array( ''.$e->getMessage().'',