未验证 提交 ee615dd0 编写于 作者: M Ming Deng 提交者: GitHub

Merge pull request #3985 from leapsea/develop

修复多线程下数据库连接异常问题
......@@ -374,6 +374,7 @@ func SetMaxIdleConns(aliasName string, maxIdleConns int) {
func SetMaxOpenConns(aliasName string, maxOpenConns int) {
al := getDbAlias(aliasName)
al.MaxOpenConns = maxOpenConns
al.DB.DB.SetMaxOpenConns(maxOpenConns)
// for tip go 1.2
if fun := reflect.ValueOf(al.DB).MethodByName("SetMaxOpenConns"); fun.IsValid() {
fun.Call([]reflect.Value{reflect.ValueOf(maxOpenConns)})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册