fix
This commit is contained in:
@@ -19,8 +19,8 @@ RestartSec=5s
|
|||||||
TimeoutStartSec=75s
|
TimeoutStartSec=75s
|
||||||
TimeoutStopSec=30s
|
TimeoutStopSec=30s
|
||||||
KillSignal=SIGTERM
|
KillSignal=SIGTERM
|
||||||
StandardOutput=journal
|
StandardOutput=append:/data/app/logs/logs.log
|
||||||
StandardError=journal
|
StandardError=inherit
|
||||||
SyslogIdentifier=ops-logs
|
SyslogIdentifier=ops-logs
|
||||||
LimitNOFILE=1048576
|
LimitNOFILE=1048576
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"git.apinb.com/bsm-sdk/core/cache/redis"
|
"git.apinb.com/bsm-sdk/core/cache/redis"
|
||||||
"git.apinb.com/bsm-sdk/core/conf"
|
"git.apinb.com/bsm-sdk/core/conf"
|
||||||
"git.apinb.com/bsm-sdk/core/database"
|
"git.apinb.com/bsm-sdk/core/database"
|
||||||
|
"git.apinb.com/bsm-sdk/core/types"
|
||||||
"git.apinb.com/bsm-sdk/core/vars"
|
"git.apinb.com/bsm-sdk/core/vars"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@@ -14,7 +15,13 @@ func newDatabase(cfg *conf.DBConf) *gorm.DB {
|
|||||||
if cfg == nil || len(cfg.Source) == 0 {
|
if cfg == nil || len(cfg.Source) == 0 {
|
||||||
panic("database source is required")
|
panic("database source is required")
|
||||||
}
|
}
|
||||||
db, err := database.NewDatabase(cfg.Driver, cfg.Source, nil)
|
db, err := database.NewDatabase(cfg.Driver, cfg.Source, &types.SqlOptions{
|
||||||
|
MaxIdleConns: vars.SqlOptionMaxIdleConns,
|
||||||
|
MaxOpenConns: vars.SqlOptionMaxOpenConns,
|
||||||
|
ConnMaxLifetime: vars.SqlOptionConnMaxLifetime,
|
||||||
|
LogStdout: false,
|
||||||
|
Debug: false,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("database init failed: %v", err))
|
panic(fmt.Sprintf("database init failed: %v", err))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user