summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-09-15 19:30:19 +0800
committerGitHub <noreply@github.com>2021-09-15 19:30:19 +0800
commit45ebcb0d1c7155dc391f8cfdbf9d7b741fd6e20b (patch)
tree783753a647fa7c1c5341b7661206cf506abfcfb1 /modules
parentdb6b7db06df5feee87c29000c19a52dbf9a150cc (diff)
downloadgitea-45ebcb0d1c7155dc391f8cfdbf9d7b741fd6e20b.tar.gz
gitea-45ebcb0d1c7155dc391f8cfdbf9d7b741fd6e20b.zip
Fix bug of migrate comments which only fetch one page (#17055)
* Fix bug of migrate comments which only fetch one page * add next page to trace Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'modules')
-rw-r--r--modules/migrations/github.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/migrations/github.go b/modules/migrations/github.go
index 54af10d116..97e1b672ac 100644
--- a/modules/migrations/github.go
+++ b/modules/migrations/github.go
@@ -521,6 +521,9 @@ func (g *GithubDownloaderV3) GetAllComments(page, perPage int) ([]*base.Comment,
created = "created"
asc = "asc"
)
+ if perPage > g.maxPerPage {
+ perPage = g.maxPerPage
+ }
opt := &github.IssueListCommentsOptions{
Sort: &created,
Direction: &asc,
@@ -535,7 +538,9 @@ func (g *GithubDownloaderV3) GetAllComments(page, perPage int) ([]*base.Comment,
if err != nil {
return nil, false, fmt.Errorf("error while listing repos: %v", err)
}
- log.Trace("Request get comments %d/%d, but in fact get %d", perPage, page, len(comments))
+ var isEnd = resp.NextPage == 0
+
+ log.Trace("Request get comments %d/%d, but in fact get %d, next page is %d", perPage, page, len(comments), resp.NextPage)
g.rate = &resp.Rate
for _, comment := range comments {
// get reactions
@@ -575,7 +580,7 @@ func (g *GithubDownloaderV3) GetAllComments(page, perPage int) ([]*base.Comment,
})
}
- return allComments, len(allComments) < perPage, nil
+ return allComments, isEnd, nil
}
// GetPullRequests returns pull requests according page and perPage