From e37e217602989afd9f5700827a0b10377f793397 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 20 Apr 2020 04:23:28 +0200 Subject: [PATCH] [Fix] RetryDownloader (add GetReviews()) (#11093) * add GetReviews() to RetryDownloader --- modules/migrations/base/downloader.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/migrations/base/downloader.go b/modules/migrations/base/downloader.go index 5de8c9513b..c31f3df1d1 100644 --- a/modules/migrations/base/downloader.go +++ b/modules/migrations/base/downloader.go @@ -186,3 +186,19 @@ func (d *RetryDownloader) GetPullRequests(page, perPage int) ([]*PullRequest, er } return nil, err } + +// GetReviews returns pull requests reviews +func (d *RetryDownloader) GetReviews(pullRequestNumber int64) ([]*Review, error) { + var ( + times = d.RetryTimes + reviews []*Review + err error + ) + for ; times > 0; times-- { + if reviews, err = d.Downloader.GetReviews(pullRequestNumber); err == nil { + return reviews, nil + } + time.Sleep(time.Second * time.Duration(d.RetryDelay)) + } + return nil, err +}