private/dbutil: set connMaxLifetime to 30 minutes

To prevent longlived unused connections, set the maximum time to 30 minutes to
prevent proxies and loadbalancers forcefully cutting the connection.
This helps in scenarios with low load/requests to a DB.

Change-Id: I7dba15ef97f6f6541e872a6fb1d3a9bbbfe5bb50
This commit is contained in:
stefanbenten 2020-08-28 17:50:57 +02:00 committed by Stefan Benten
parent 60a95d0dc9
commit 4645805b18
2 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ import (
var (
maxIdleConns = flag.Int("db.max_idle_conns", 1, "Maximum Amount of Idle Database connections, -1 means the stdlib default")
maxOpenConns = flag.Int("db.max_open_conns", 5, "Maximum Amount of Open Database connections, -1 means the stdlib default")
connMaxLifetime = flag.Duration("db.conn_max_lifetime", -1, "Maximum Database Connection Lifetime, -1ns means the stdlib default")
connMaxLifetime = flag.Duration("db.conn_max_lifetime", 30*time.Minute, "Maximum Database Connection Lifetime, -1ns means the stdlib default")
)
// ConfigurableDB contains methods for configuring a database.

View File

@ -152,7 +152,7 @@ contact.external-address: ""
# db-cleanup.serials-interval: 4h0m0s
# Maximum Database Connection Lifetime, -1ns means the stdlib default
# db.conn_max_lifetime: -1ns
# db.conn_max_lifetime: 30m0s
# Maximum Amount of Idle Database connections, -1 means the stdlib default
# db.max_idle_conns: 1