summaryrefslogtreecommitdiffstats
path: root/modules/migrations/restore.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-06-30 15:23:49 +0800
committerGitHub <noreply@github.com>2021-06-30 15:23:49 +0800
commit09663493543a2ce15fc90fbb3808dda5b87335e5 (patch)
treee9b2ce99e5f0bb3c3115e129feb8194cb9f20f7f /modules/migrations/restore.go
parente8c6cead0fb926ced6595c7b22f56b1cc2540435 (diff)
downloadgitea-09663493543a2ce15fc90fbb3808dda5b87335e5.tar.gz
gitea-09663493543a2ce15fc90fbb3808dda5b87335e5.zip
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
Diffstat (limited to 'modules/migrations/restore.go')
-rw-r--r--modules/migrations/restore.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/migrations/restore.go b/modules/migrations/restore.go
index 5b44811d52..6177f80cbb 100644
--- a/modules/migrations/restore.go
+++ b/modules/migrations/restore.go
@@ -212,27 +212,27 @@ func (r *RepositoryRestorer) GetIssues(page, perPage int) ([]*base.Issue, bool,
}
// GetComments returns comments according issueNumber
-func (r *RepositoryRestorer) GetComments(issueNumber int64) ([]*base.Comment, error) {
+func (r *RepositoryRestorer) GetComments(opts base.GetCommentOptions) ([]*base.Comment, bool, error) {
var comments = make([]*base.Comment, 0, 10)
- p := filepath.Join(r.commentDir(), fmt.Sprintf("%d.yml", issueNumber))
+ p := filepath.Join(r.commentDir(), fmt.Sprintf("%d.yml", opts.IssueNumber))
_, err := os.Stat(p)
if err != nil {
if os.IsNotExist(err) {
- return nil, nil
+ return nil, false, nil
}
- return nil, err
+ return nil, false, err
}
bs, err := ioutil.ReadFile(p)
if err != nil {
- return nil, err
+ return nil, false, err
}
err = yaml.Unmarshal(bs, &comments)
if err != nil {
- return nil, err
+ return nil, false, err
}
- return comments, nil
+ return comments, false, nil
}
// GetPullRequests returns pull requests according page and perPage