Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-30 22:06:11 +01:00

fix possbile mysql invalid connnection error (#7051)

This commit is contained in:
Lunny Xiao 2019-05-26 21:28:33 +08:00 committed by Lauris BH
parent 063fa99159
commit c2f3938a58

View file

@ -14,6 +14,7 @@ import (
"path"
"path/filepath"
"strings"
"time"
"code.gitea.io/gitea/modules/setting"
@ -278,6 +279,11 @@ func SetEngine() (err error) {
// so use log file to instead print to stdout.
x.SetLogger(NewXORMLogger(setting.LogSQL))
x.ShowSQL(setting.LogSQL)
if DbCfg.Type == "mysql" {
x.SetMaxIdleConns(0)
x.SetConnMaxLifetime(3 * time.Second)
}
return nil
}