maxlefttime
This commit is contained in:
parent
36279cbf5b
commit
cc44b0ba9c
11
lxDb/db.go
11
lxDb/db.go
@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"git.listensoft.net/tool/lxutils/lxlog"
|
||||
"git.listensoft.net/tool/lxutils/lxzap"
|
||||
@ -136,8 +137,9 @@ func InitDB(env string, conf DbConfig) {
|
||||
panic(err)
|
||||
}
|
||||
// 设置连接池参数
|
||||
sqlDB.SetMaxIdleConns(conf.MaxIdleConns) // 设置最大空闲连接数为10
|
||||
sqlDB.SetMaxOpenConns(conf.MaxOpenConns) // 设置最大打开连接数为100
|
||||
sqlDB.SetMaxIdleConns(conf.MaxIdleConns) // 设置最大空闲连接数为10
|
||||
sqlDB.SetMaxOpenConns(conf.MaxOpenConns) // 设置最大打开连接数为100
|
||||
sqlDB.SetConnMaxLifetime(100 * time.Second) // 设置最大打开连接数为100
|
||||
}
|
||||
|
||||
DBS[conf.Name] = db
|
||||
@ -161,8 +163,9 @@ func InitDB(env string, conf DbConfig) {
|
||||
panic(err)
|
||||
}
|
||||
// 设置连接池参数
|
||||
sqlDB.SetMaxIdleConns(conf.MaxIdleConns) // 设置最大空闲连接数为10
|
||||
sqlDB.SetMaxOpenConns(conf.MaxOpenConns) // 设置最大打开连接数为100
|
||||
sqlDB.SetMaxIdleConns(conf.MaxIdleConns) // 设置最大空闲连接数为10
|
||||
sqlDB.SetMaxOpenConns(conf.MaxOpenConns) // 设置最大打开连接数为100
|
||||
sqlDB.SetConnMaxLifetime(100 * time.Second) // 设置最大打开连接数为100
|
||||
}
|
||||
|
||||
DBS[conf.Name] = db
|
||||
|
||||
@ -28,7 +28,7 @@ func InitRedis(conf RedisConfig) {
|
||||
MaxIdle: conf.MaxIdle,
|
||||
MaxActive: conf.MaxActive,
|
||||
IdleTimeout: 240 * time.Second,
|
||||
Wait: true,
|
||||
Wait: false,
|
||||
Dial: func() (redis.Conn, error) {
|
||||
c, err := redis.Dial("tcp", conf.URL, redis.DialPassword(conf.Password))
|
||||
if err != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user