Make the github migration less rate limit waiting to get comment per page from repository but not per issue (#16070)
* Make the github migration less rate limit waiting to get comment per page from repository but not per issue * Fix lint * adjust Downloader interface * Fix missed reviews * Fix test * Remove unused struct
This commit is contained in:
parent
e8c6cead0f
commit
0966349354
13 changed files with 194 additions and 56 deletions
|
@ -430,7 +430,8 @@ func (g *GitlabDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, er
|
|||
|
||||
// GetComments returns comments according issueNumber
|
||||
// TODO: figure out how to transfer comment reactions
|
||||
func (g *GitlabDownloader) GetComments(issueNumber int64) ([]*base.Comment, error) {
|
||||
func (g *GitlabDownloader) GetComments(opts base.GetCommentOptions) ([]*base.Comment, bool, error) {
|
||||
var issueNumber = opts.IssueNumber
|
||||
var allComments = make([]*base.Comment, 0, g.maxPerPage)
|
||||
|
||||
var page = 1
|
||||
|
@ -457,7 +458,7 @@ func (g *GitlabDownloader) GetComments(issueNumber int64) ([]*base.Comment, erro
|
|||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error while listing comments: %v %v", g.repoID, err)
|
||||
return nil, false, fmt.Errorf("error while listing comments: %v %v", g.repoID, err)
|
||||
}
|
||||
for _, comment := range comments {
|
||||
// Flatten comment threads
|
||||
|
@ -490,7 +491,7 @@ func (g *GitlabDownloader) GetComments(issueNumber int64) ([]*base.Comment, erro
|
|||
}
|
||||
page = resp.NextPage
|
||||
}
|
||||
return allComments, nil
|
||||
return allComments, true, nil
|
||||
}
|
||||
|
||||
// GetPullRequests returns pull requests according page and perPage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue