From 06feb6af3bffd1a72c86b6f92c9f1df714bdd6e7 Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Tue, 9 Jun 2020 18:10:57 +0200 Subject: [PATCH] Set db conn limits (max lifetime, max open/idle) --- pkg/db/connector.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/db/connector.go b/pkg/db/connector.go index f1245da5a..282c168b4 100644 --- a/pkg/db/connector.go +++ b/pkg/db/connector.go @@ -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