From 930fdd1610eb0e0dc336102461df6d8d19b0ec3a Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 4 Feb 2021 12:14:25 +0800 Subject: [PATCH] Fix rate limit bug when downloading assets on migrating from github --- modules/migrations/github.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/migrations/github.go b/modules/migrations/github.go index 4d832387ba30e..8d49f9308e8ab 100644 --- a/modules/migrations/github.go +++ b/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 }