Make database open attempts configurable also via config file

This commit is contained in:
Frank Steinborn
2019-08-21 13:16:27 +02:00
committed by Andrey Smirnov
parent 586f879e80
commit 98e75f6d97
9 changed files with 27 additions and 2 deletions

View File

@@ -259,7 +259,13 @@ func (context *AptlyContext) _database() (database.Storage, error) {
}
}
tries := context.flags.Lookup("db-open-attempts").Value.Get().(int)
var tries int
if context.config().DatabaseOpenAttempts == -1 {
tries = context.flags.Lookup("db-open-attempts").Value.Get().(int)
} else {
tries = context.config().DatabaseOpenAttempts
}
const BaseDelay = 10 * time.Second
const Jitter = 1 * time.Second