mirror of
https://github.com/go-gitea/gitea
synced 2024-12-25 01:54:26 +00:00
* Fix bug of migrate comments which only fetch one page * add next page to trace Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
1f8df5dd89
commit
fd35f56e87
@ -541,6 +541,9 @@ func (g *GithubDownloaderV3) GetAllComments(page, perPage int) ([]*base.Comment,
|
|||||||
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,
|
||||||
@ -555,7 +558,9 @@ func (g *GithubDownloaderV3) GetAllComments(page, perPage int) ([]*base.Comment,
|
|||||||
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 {
|
||||||
var email string
|
var email string
|
||||||
@ -600,7 +605,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
|
// GetPullRequests returns pull requests according page and perPage
|
||||||
|
Loading…
Reference in New Issue
Block a user