refactor: new bun config
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dawid Wysokiński 2022-11-05 07:16:39 +01:00
parent 2cc015a0c2
commit 88f7608db7
Signed by: Kichiyaki
GPG Key ID: B5445E357FB8B892
3 changed files with 3 additions and 5 deletions

View File

@ -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
}

View File

@ -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:

View File

@ -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: