From 1b7182e5ec746d65146a3a9f78989ee1a9fb88a9 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 16 Nov 2019 16:30:06 +0800 Subject: 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 --- modules/migrations/migrate.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'modules/migrations/migrate.go') 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) -- cgit v1.2.3