1
0
Fork 0

Fail hard only after 3 failed attempts

pull/1609/head
Jordi Boggiano 2013-02-21 18:16:54 +01:00
parent c7ed20e9d8
commit 2c4c5dd764
1 changed files with 13 additions and 12 deletions

View File

@ -483,26 +483,27 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository
break; break;
} catch (\Exception $e) { } catch (\Exception $e) {
if ($retries) {
usleep(100);
continue;
}
if ($e instanceof RepositorySecurityException) { if ($e instanceof RepositorySecurityException) {
throw $e; throw $e;
} }
if (!$retries) { if ($contents = $this->cache->read($cacheKey)) {
if ($contents = $this->cache->read($cacheKey)) { if (!$this->degradedMode) {
if (!$this->degradedMode) { $this->io->write('<warning>'.$e->getMessage().'</warning>');
$this->io->write('<warning>'.$e->getMessage().'</warning>'); $this->io->write('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
$this->io->write('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
}
$this->degradedMode = true;
$data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
break;
} }
$this->degradedMode = true;
$data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
throw $e; break;
} }
usleep(100); throw $e;
} }
} }