Set db conn limits (max lifetime, max open/idle)

This commit is contained in:
Denis Arh
2020-06-09 18:21:33 +02:00
parent 681fca878d
commit 06feb6af3b
+6
View File
@@ -80,6 +80,12 @@ func TryToConnect(ctx context.Context, log *zap.Logger, opt options.DBOpt) (db *
}
}
// hardcoded values for POC
// @todo make this configurable, same as other options (DB_*)
db.SetConnMaxLifetime(10 * time.Minute)
db.SetMaxOpenConns(256)
db.SetMaxIdleConns(32)
log.Debug("connected to the database", dsnField)
// Connected