mirror of
https://github.com/gogs/gogs.git
synced 2025-05-23 16:00:56 +00:00
models: disable idle connection and set connection max life time (#5532)
This commit is contained in:
parent
d862c43be0
commit
0a176df6fb
2
gogs.go
2
gogs.go
@ -16,7 +16,7 @@ import (
|
||||
"github.com/gogs/gogs/pkg/setting"
|
||||
)
|
||||
|
||||
const APP_VER = "0.11.86.0130"
|
||||
const APP_VER = "0.11.87.0206"
|
||||
|
||||
func init() {
|
||||
setting.AppVer = APP_VER
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Unknwon/com"
|
||||
_ "github.com/denisenkom/go-mssqldb"
|
||||
@ -200,6 +201,11 @@ func SetEngine() (err error) {
|
||||
return fmt.Errorf("Fail to create 'xorm.log': %v", err)
|
||||
}
|
||||
|
||||
// To prevent mystery "MySQL: invalid connection" error,
|
||||
// see https://github.com/gogs/gogs/issues/5532.
|
||||
x.SetMaxIdleConns(0)
|
||||
x.SetConnMaxLifetime(time.Second)
|
||||
|
||||
if setting.ProdMode {
|
||||
x.SetLogger(xorm.NewSimpleLogger3(logger, xorm.DEFAULT_LOG_PREFIX, xorm.DEFAULT_LOG_FLAG, core.LOG_WARNING))
|
||||
} else {
|
||||
|
@ -1 +1 @@
|
||||
0.11.86.0130
|
||||
0.11.87.0206
|
||||
|
Loading…
x
Reference in New Issue
Block a user