mirror of
https://github.com/astaxie/beego.git
synced 2024-11-05 09:20:55 +00:00
修复数据库连接异常问题
This commit is contained in:
parent
8f3d1c5f42
commit
867f83de34
@ -374,6 +374,7 @@ func SetMaxIdleConns(aliasName string, maxIdleConns int) {
|
|||||||
func SetMaxOpenConns(aliasName string, maxOpenConns int) {
|
func SetMaxOpenConns(aliasName string, maxOpenConns int) {
|
||||||
al := getDbAlias(aliasName)
|
al := getDbAlias(aliasName)
|
||||||
al.MaxOpenConns = maxOpenConns
|
al.MaxOpenConns = maxOpenConns
|
||||||
|
al.DB.DB.SetMaxOpenConns(maxOpenConns)
|
||||||
// for tip go 1.2
|
// for tip go 1.2
|
||||||
if fun := reflect.ValueOf(al.DB).MethodByName("SetMaxOpenConns"); fun.IsValid() {
|
if fun := reflect.ValueOf(al.DB).MethodByName("SetMaxOpenConns"); fun.IsValid() {
|
||||||
fun.Call([]reflect.Value{reflect.ValueOf(maxOpenConns)})
|
fun.Call([]reflect.Value{reflect.ValueOf(maxOpenConns)})
|
||||||
|
Loading…
Reference in New Issue
Block a user