Browse Source

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>
tags/v1.16.0-rc1
Lunny Xiao 2 years ago
parent
commit
45ebcb0d1c
No account linked to committer's email address
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      modules/migrations/github.go

+ 7
- 2
modules/migrations/github.go View File

created = "created" created = "created"
asc = "asc" asc = "asc"
) )
if perPage > g.maxPerPage {
perPage = g.maxPerPage
}
opt := &github.IssueListCommentsOptions{ opt := &github.IssueListCommentsOptions{
Sort: &created, Sort: &created,
Direction: &asc, Direction: &asc,
if err != nil { if err != nil {
return nil, false, fmt.Errorf("error while listing repos: %v", err) 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 g.rate = &resp.Rate
for _, comment := range comments { for _, comment := range comments {
// get reactions // get reactions
}) })
} }


return allComments, len(allComments) < perPage, nil
return allComments, isEnd, nil
} }


// GetPullRequests returns pull requests according page and perPage // GetPullRequests returns pull requests according page and perPage

Loading…
Cancel
Save