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 authored and 6543 committed Feb 6, 2021
1 parent 19fccdc commit 930fdd1
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 930fdd1

Please sign in to comment.