mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -06:00
Retry getting tags
This commit is contained in:
parent
761d777427
commit
a09828b751
|
|
@ -259,10 +259,20 @@ func buildDendrite(httpClient *http.Client, dockerClient *client.Client, tmpDir
|
|||
|
||||
func getAndSortVersionsFromGithub(httpClient *http.Client) (semVers []*semver.Version, err error) {
|
||||
u := "https://api.github.com/repos/matrix-org/dendrite/tags"
|
||||
res, err := httpClient.Get(u)
|
||||
|
||||
var res *http.Response
|
||||
for i := 0; i < 3; i++ {
|
||||
res, err = httpClient.Get(u)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if res.StatusCode == 200 {
|
||||
break
|
||||
}
|
||||
log.Printf("Github API returned HTTP %d, retrying\n", res.StatusCode)
|
||||
time.Sleep(time.Second * 5)
|
||||
}
|
||||
|
||||
if res.StatusCode != 200 {
|
||||
return nil, fmt.Errorf("%s returned HTTP %d", u, res.StatusCode)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue