SQLStore: Optionally retry queries if sqlite returns database is locked (#56096)
* SQLStore: Retry queries if sqlite returns database is locked * Configurable retries * Apply suggestions from code review Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
This commit is contained in:
co-authored by
Christopher Moyer
parent
920d2aa599
commit
46fb4081ba
@@ -455,6 +455,9 @@ func (ss *SQLStore) readConfig() error {
|
||||
ss.dbCfg.CacheMode = sec.Key("cache_mode").MustString("private")
|
||||
ss.dbCfg.SkipMigrations = sec.Key("skip_migrations").MustBool()
|
||||
ss.dbCfg.MigrationLockAttemptTimeout = sec.Key("locking_attempt_timeout_sec").MustInt()
|
||||
|
||||
ss.dbCfg.QueryRetries = sec.Key("query_retries").MustInt()
|
||||
ss.dbCfg.TransactionRetries = sec.Key("transaction_retries").MustInt(5)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -671,4 +674,8 @@ type DatabaseConfig struct {
|
||||
UrlQueryParams map[string][]string
|
||||
SkipMigrations bool
|
||||
MigrationLockAttemptTimeout int
|
||||
// SQLite only
|
||||
QueryRetries int
|
||||
// SQLite only
|
||||
TransactionRetries int
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user