1
0
Fork 0

remove Github 404 retries

pull/7574/head
Farhad Safarov 2018-08-21 15:51:20 +04:00
parent 3d01ef28fa
commit 4014c914ab
1 changed files with 5 additions and 22 deletions

View File

@ -183,9 +183,6 @@ class GitHubDriver extends VcsDriver
return $this->gitDriver->getFileContent($file, $identifier); return $this->gitDriver->getFileContent($file, $identifier);
} }
$notFoundRetries = 2;
while ($notFoundRetries) {
try {
$resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier); $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
$resource = JsonFile::parseJson($this->getContents($resource)); $resource = JsonFile::parseJson($this->getContents($resource));
if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) { if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
@ -193,20 +190,6 @@ class GitHubDriver extends VcsDriver
} }
return $content; return $content;
} catch (TransportException $e) {
if (404 !== $e->getCode()) {
throw $e;
}
// TODO should be removed when possible
// retry fetching if github returns a 404 since they happen randomly
$notFoundRetries--;
return null;
}
}
return null;
} }
/** /**