Fix rate limit bug when downloading assets on migrating from github (#14564)
This commit is contained in:
parent
cbe7f5296e
commit
240fea8c14
1 changed files with 5 additions and 0 deletions
|
@ -301,10 +301,15 @@ func (g *GithubDownloaderV3) convertGithubRelease(rel *github.RepositoryRelease)
|
||||||
Created: asset.CreatedAt.Time,
|
Created: asset.CreatedAt.Time,
|
||||||
Updated: asset.UpdatedAt.Time,
|
Updated: asset.UpdatedAt.Time,
|
||||||
DownloadFunc: func() (io.ReadCloser, error) {
|
DownloadFunc: func() (io.ReadCloser, error) {
|
||||||
|
g.sleep()
|
||||||
asset, redir, err := g.client.Repositories.DownloadReleaseAsset(g.ctx, g.repoOwner, g.repoName, *asset.ID, http.DefaultClient)
|
asset, redir, err := g.client.Repositories.DownloadReleaseAsset(g.ctx, g.repoOwner, g.repoName, *asset.ID, http.DefaultClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
err = g.RefreshRate()
|
||||||
|
if err != nil {
|
||||||
|
log.Error("g.client.RateLimits: %s", err)
|
||||||
|
}
|
||||||
if asset == nil {
|
if asset == nil {
|
||||||
return ioutil.NopCloser(bytes.NewBufferString(redir)), nil
|
return ioutil.NopCloser(bytes.NewBufferString(redir)), nil
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue