Skip to content

Commit 240fea8

Browse files
authored
Fix rate limit bug when downloading assets on migrating from github (#14564)
1 parent cbe7f52 commit 240fea8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

modules/migrations/github.go

+5
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,15 @@ func (g *GithubDownloaderV3) convertGithubRelease(rel *github.RepositoryRelease)
301301
Created: asset.CreatedAt.Time,
302302
Updated: asset.UpdatedAt.Time,
303303
DownloadFunc: func() (io.ReadCloser, error) {
304+
g.sleep()
304305
asset, redir, err := g.client.Repositories.DownloadReleaseAsset(g.ctx, g.repoOwner, g.repoName, *asset.ID, http.DefaultClient)
305306
if err != nil {
306307
return nil, err
307308
}
309+
err = g.RefreshRate()
310+
if err != nil {
311+
log.Error("g.client.RateLimits: %s", err)
312+
}
308313
if asset == nil {
309314
return ioutil.NopCloser(bytes.NewBufferString(redir)), nil
310315
}

0 commit comments

Comments
 (0)