summaryrefslogtreecommitdiffstats
path: root/modules/migrations/migrate.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-11-16 16:30:06 +0800
committerGitHub <noreply@github.com>2019-11-16 16:30:06 +0800
commit1b7182e5ec746d65146a3a9f78989ee1a9fb88a9 (patch)
treeee27fafdbea9adfd80a09fa538998e2e8a8742f8 /modules/migrations/migrate.go
parent6fbfffeeb8fa23327660e8f8e168644bc93bf42b (diff)
downloadgitea-1b7182e5ec746d65146a3a9f78989ee1a9fb88a9.tar.gz
gitea-1b7182e5ec746d65146a3a9f78989ee1a9fb88a9.zip
Add retry for migration http/https requests (#9019)
* Add retry for migration http/https requests * give the more suitable name for retry configuraion items * fix docs and lint * Only use retryDownloader when setting > 1
Diffstat (limited to 'modules/migrations/migrate.go')
-rw-r--r--modules/migrations/migrate.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/migrations/migrate.go b/modules/migrations/migrate.go
index 7a5071e125..cfaedf78e3 100644
--- a/modules/migrations/migrate.go
+++ b/modules/migrations/migrate.go
@@ -11,6 +11,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations/base"
+ "code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
)
@@ -63,6 +64,11 @@ func MigrateRepository(doer *models.User, ownerName string, opts base.MigrateOpt
}
uploader.gitServiceType = opts.GitServiceType
+
+ if setting.Migrations.MaxAttempts > 1 {
+ downloader = base.NewRetryDownloader(downloader, setting.Migrations.MaxAttempts, setting.Migrations.RetryBackoff)
+ }
+
if err := migrateRepository(downloader, uploader, opts); err != nil {
if err1 := uploader.Rollback(); err1 != nil {
log.Error("rollback failed: %v", err1)