summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/models.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/models/models.go b/models/models.go
index 85318af870..c1d4c100d0 100644
--- a/models/models.go
+++ b/models/models.go
@@ -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
}