Skip to content

Commit f52bf7d

Browse files
committed
give the more suitable name for retry configuraion items
1 parent 571de20 commit f52bf7d

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

custom/conf/app.ini.sample

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ QUEUE_LENGTH = 1000
894894
QUEUE_CONN_STR = "addrs=127.0.0.1:6379 db=0"
895895

896896
[migrations]
897-
; Retry times on migrations for every http/https request.
898-
RETRY_MAX_TIMES = 3
899-
; Time as seconds to delay before next retry.
900-
RETRY_DELAY = 3
897+
; Max attempts per http/https request on migrations.
898+
MAX_ATTEMPTS = 3
899+
; Backoff time per http/https request retry (seconds)
900+
RETRY_BACKOFF = 3

modules/migrations/migrate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ func MigrateRepository(doer *models.User, ownerName string, opts base.MigrateOpt
6565

6666
uploader.gitServiceType = opts.GitServiceType
6767

68-
if setting.Migrations.RetryMaxTimes > 0 {
69-
downloader = base.NewRetryDownloader(downloader, setting.Migrations.RetryMaxTimes+1, setting.Migrations.RetryDelay)
68+
if setting.Migrations.MaxAttempts > 0 {
69+
downloader = base.NewRetryDownloader(downloader, setting.Migrations.MaxAttempts, setting.Migrations.RetryBackoff)
7070
}
7171

7272
if err := migrateRepository(downloader, uploader, opts); err != nil {

modules/setting/migrations.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ package setting
77
var (
88
// Migrations settings
99
Migrations = struct {
10-
RetryMaxTimes int
11-
RetryDelay int
10+
MaxAttempts int
11+
RetryBackoff int
1212
}{
13-
RetryMaxTimes: 2, // after failure, it will try again x times.
14-
RetryDelay: 3, // delay seconds before next retry
13+
MaxAttempts: 3,
14+
RetryBackoff: 3,
1515
}
1616
)
1717

1818
func newMigrationsService() {
1919
sec := Cfg.Section("migrations")
20-
Migrations.RetryMaxTimes = sec.Key("RETRY_MAX_TIMES").MustInt(Migrations.RetryMaxTimes)
21-
Migrations.RetryDelay = sec.Key("RETRY_DELAY").MustInt(Migrations.RetryDelay)
20+
Migrations.MaxAttempts = sec.Key("MAX_ATTEMPTS").MustInt(Migrations.MaxAttempts)
21+
Migrations.RetryBackoff = sec.Key("RETRY_BACKOFF").MustInt(Migrations.RetryBackoff)
2222
}

0 commit comments

Comments
 (0)