aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-02-07 23:56:11 +0800
committerGitHub <noreply@github.com>2021-02-07 15:56:11 +0000
commit240fea8c14434f836677e6c883ef90523950ece5 (patch)
treeabf503778bb7cbf2deb591ffceed5b2f4b2ee311
parentcbe7f5296e0400a6327b484cf78d6ffb93c9dd2c (diff)
downloadgitea-240fea8c14434f836677e6c883ef90523950ece5.tar.gz
gitea-240fea8c14434f836677e6c883ef90523950ece5.zip
Fix rate limit bug when downloading assets on migrating from github (#14564)
-rw-r--r--modules/migrations/github.go5
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
}