diff options
author | Paul Brackin <pbrackin@users.noreply.github.com> | 2019-01-19 13:17:08 -0800 |
---|---|---|
committer | techknowlogick <hello@techknowlogick.com> | 2019-01-19 16:17:08 -0500 |
commit | 1bb22b2b4777b47b05bf023d7737c03dc9560b09 (patch) | |
tree | 37373f5a1f9d13c66bdee8579f4455a3b316cfb6 /modules/setting/setting.go | |
parent | f54e0d2f16b7e29b01d5745d94915e5ef52a9455 (diff) | |
download | gitea-1bb22b2b4777b47b05bf023d7737c03dc9560b09.tar.gz gitea-1bb22b2b4777b47b05bf023d7737c03dc9560b09.zip |
Make db connect more robust (#5738)
Diffstat (limited to 'modules/setting/setting.go')
-rw-r--r-- | modules/setting/setting.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 437c86ff6d..e561b4f96b 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -169,12 +169,14 @@ var ( DisableGitHooks bool // Database settings - UseSQLite3 bool - UseMySQL bool - UseMSSQL bool - UsePostgreSQL bool - UseTiDB bool - LogSQL bool + UseSQLite3 bool + UseMySQL bool + UseMSSQL bool + UsePostgreSQL bool + UseTiDB bool + LogSQL bool + DBConnectRetries int + DBConnectBackoff time.Duration // Indexer settings Indexer struct { @@ -986,6 +988,8 @@ func NewContext() { } IterateBufferSize = Cfg.Section("database").Key("ITERATE_BUFFER_SIZE").MustInt(50) LogSQL = Cfg.Section("database").Key("LOG_SQL").MustBool(true) + DBConnectRetries = Cfg.Section("database").Key("DB_RETRIES").MustInt(10) + DBConnectBackoff = Cfg.Section("database").Key("DB_RETRY_BACKOFF").MustDuration(3 * time.Second) sec = Cfg.Section("attachment") AttachmentPath = sec.Key("PATH").MustString(path.Join(AppDataPath, "attachments")) |