Skip to content

Commit

Permalink
Fix rate limit bug when downloading assets on migrating from github (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Feb 7, 2021
1 parent cbe7f52 commit 240fea8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/migrations/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 240fea8

Please sign in to comment.