Fix rate limit bug when downloading assets on migrating from github (#14564)

tokarchuk/v1.17
Lunny Xiao 4 years ago committed by GitHub
parent cbe7f5296e
commit 240fea8c14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      modules/migrations/github.go

@ -301,10 +301,15 @@ func (g *GithubDownloaderV3) convertGithubRelease(rel *github.RepositoryRelease)
Created: asset.CreatedAt.Time,
Updated: asset.UpdatedAt.Time,
DownloadFunc: func() (io.ReadCloser, error) {
g.sleep()
asset, redir, err := g.client.Repositories.DownloadReleaseAsset(g.ctx, g.repoOwner, g.repoName, *asset.ID, http.DefaultClient)
if err != nil {
return nil, err
}
err = g.RefreshRate()
if err != nil {
log.Error("g.client.RateLimits: %s", err)
}
if asset == nil {
return ioutil.NopCloser(bytes.NewBufferString(redir)), nil
}

Loading…
Cancel
Save