diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-02-07 23:56:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-07 15:56:11 +0000 |
commit | 240fea8c14434f836677e6c883ef90523950ece5 (patch) | |
tree | abf503778bb7cbf2deb591ffceed5b2f4b2ee311 | |
parent | cbe7f5296e0400a6327b484cf78d6ffb93c9dd2c (diff) | |
download | gitea-240fea8c14434f836677e6c883ef90523950ece5.tar.gz gitea-240fea8c14434f836677e6c883ef90523950ece5.zip |
Fix rate limit bug when downloading assets on migrating from github (#14564)
-rw-r--r-- | modules/migrations/github.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/migrations/github.go b/modules/migrations/github.go index 4d832387ba..8d49f9308e 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 } |