refactor: new bun config
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2cc015a0c2
commit
88f7608db7
|
@ -23,9 +23,8 @@ const (
|
|||
type bunConfig struct {
|
||||
DSN string `envconfig:"DSN" required:"true"`
|
||||
MaxOpenConnections int `envconfig:"MAX_OPEN_CONNECTIONS" default:"5"`
|
||||
MaxIdleConnections int `envconfig:"MAX_IDLE_CONNECTIONS" default:"5"`
|
||||
MaxIdleConnections int `envconfig:"MAX_IDLE_CONNECTIONS" default:"2"`
|
||||
ConnectionMaxLifetime time.Duration `envconfig:"CONNECTION_MAX_LIFETIME" default:"3m"`
|
||||
ConnectionMaxIdleTime time.Duration `envconfig:"CONNECTION_MAX_IDLE_TIME" default:"5m"`
|
||||
}
|
||||
|
||||
func NewBunDB() (*bun.DB, error) {
|
||||
|
@ -51,6 +50,5 @@ func newSQLDB(cfg bunConfig) *sql.DB {
|
|||
db.SetMaxOpenConns(cfg.MaxOpenConnections)
|
||||
db.SetMaxIdleConns(cfg.MaxIdleConnections)
|
||||
db.SetConnMaxLifetime(cfg.ConnectionMaxLifetime)
|
||||
db.SetConnMaxIdleTime(cfg.ConnectionMaxIdleTime)
|
||||
return db
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ spec:
|
|||
- name: DB_MAX_OPEN_CONNECTIONS
|
||||
value: "10"
|
||||
- name: DB_MAX_IDLE_CONNECTIONS
|
||||
value: "2"
|
||||
value: "3"
|
||||
- name: BOT_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
|
|
|
@ -19,7 +19,7 @@ spec:
|
|||
- name: DB_MAX_OPEN_CONNECTIONS
|
||||
value: "15"
|
||||
- name: DB_MAX_IDLE_CONNECTIONS
|
||||
value: "8"
|
||||
value: "7"
|
||||
- name: BOT_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
|
|
Loading…
Reference in New Issue
Block a user