aboutsummaryrefslogtreecommitdiffstats
path: root/modules/migrations/base
diff options
context:
space:
mode:
Diffstat (limited to 'modules/migrations/base')
-rw-r--r--modules/migrations/base/downloader.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/migrations/base/downloader.go b/modules/migrations/base/downloader.go
index b853ec3020..87ade5c02e 100644
--- a/modules/migrations/base/downloader.go
+++ b/modules/migrations/base/downloader.go
@@ -6,6 +6,7 @@
package base
import (
+ "context"
"time"
"code.gitea.io/gitea/modules/structs"
@@ -13,6 +14,7 @@ import (
// Downloader downloads the site repo informations
type Downloader interface {
+ SetContext(context.Context)
GetRepoInfo() (*Repository, error)
GetTopics() ([]string, error)
GetMilestones() ([]*Milestone, error)
@@ -30,6 +32,10 @@ type DownloaderFactory interface {
GitServiceType() structs.GitServiceType
}
+var (
+ _ Downloader = &RetryDownloader{}
+)
+
// RetryDownloader retry the downloads
type RetryDownloader struct {
Downloader
@@ -46,6 +52,11 @@ func NewRetryDownloader(downloader Downloader, retryTimes, retryDelay int) *Retr
}
}
+// SetContext set context
+func (d *RetryDownloader) SetContext(ctx context.Context) {
+ d.Downloader.SetContext(ctx)
+}
+
// GetRepoInfo returns a repository information with retry
func (d *RetryDownloader) GetRepoInfo() (*Repository, error) {
var (