db fail 当前打开连接数
This commit is contained in:
parent
37143f17fa
commit
71eb344f0c
|
|
@ -48,9 +48,11 @@ func db(data *conf.Data_Database) (*gorm.DB, func()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMaxIdleConns sets the maximum number of connections in the idle connection pool.
|
// SetMaxIdleConns sets the maximum number of connections in the idle connection pool.
|
||||||
sqlDB.SetMaxIdleConns(int(data.MaxIdle))
|
//sqlDB.SetMaxIdleConns(int(data.MaxIdle))
|
||||||
|
sqlDB.SetMaxIdleConns(1000)
|
||||||
// SetMaxOpenConns sets the maximum number of openapi connections to the database.
|
// SetMaxOpenConns sets the maximum number of openapi connections to the database.
|
||||||
sqlDB.SetMaxOpenConns(int(data.MaxOpen))
|
//sqlDB.SetMaxOpenConns(int(data.MaxOpen))
|
||||||
|
sqlDB.SetMaxOpenConns(3000)
|
||||||
// SetConnMaxLifetime sets the maximum amount of time a connection may be reused.
|
// SetConnMaxLifetime sets the maximum amount of time a connection may be reused.
|
||||||
//sqlDB.SetConnMaxLifetime(1 * time.Hour)
|
//sqlDB.SetConnMaxLifetime(1 * time.Hour)
|
||||||
sqlDB.SetConnMaxLifetime(7200 * time.Second)
|
sqlDB.SetConnMaxLifetime(7200 * time.Second)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue