浏览代码

fix possbile mysql invalid connnection error (#7051)

tags/v1.21.12.1
Lunny Xiao Lauris BH 6 年前
父节点
当前提交
c2f3938a58
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. +6
    -0
      models/models.go

+ 6
- 0
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
}



正在加载...
取消
保存