File tree Expand file tree Collapse file tree 3 files changed +4
-0
lines changed Expand file tree Collapse file tree 3 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ type BBSConfig struct {
5252 DBReadTimeout durationjson.Duration `json:"db_read_timeout,omitempty"`
5353 DBWriteTimeout durationjson.Duration `json:"db_write_timeout,omitempty"`
5454 MaxOpenDatabaseConnections int `json:"max_open_database_connections,omitempty"`
55+ MaxDatabaseConnectionLifetime durationjson.Duration `json:"max_database_connection_lifetime,omitempty"`
5556 MaxTaskRetries int `json:"max_task_retries,omitempty"`
5657 RepCACert string `json:"rep_ca_cert,omitempty"`
5758 RepClientCert string `json:"rep_client_cert,omitempty"`
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ var _ = Describe("BBSConfig", func() {
6868 },
6969 "max_idle_database_connections": 50,
7070 "max_open_database_connections": 200,
71+ "max_database_connection_lifetime": "90s",
7172 "db_connection_timeout": "30s",
7273 "db_read_timeout": "600s",
7374 "db_write_timeout": "600s",
@@ -168,6 +169,7 @@ var _ = Describe("BBSConfig", func() {
168169 LockTTL : durationjson .Duration (locket .DefaultSessionTTL ),
169170 MaxIdleDatabaseConnections : 50 ,
170171 MaxOpenDatabaseConnections : 200 ,
172+ MaxDatabaseConnectionLifetime : durationjson .Duration (90 * time .Second ),
171173 DBConnectionTimeout : durationjson .Duration (30 * time .Second ),
172174 DBReadTimeout : durationjson .Duration (600 * time .Second ),
173175 DBWriteTimeout : durationjson .Duration (600 * time .Second ),
Original file line number Diff line number Diff line change @@ -120,6 +120,7 @@ func main() {
120120
121121 sqlConn .SetMaxOpenConns (bbsConfig .MaxOpenDatabaseConnections )
122122 sqlConn .SetMaxIdleConns (bbsConfig .MaxIdleDatabaseConnections )
123+ sqlConn .SetConnMaxLifetime (time .Duration (bbsConfig .MaxDatabaseConnectionLifetime ))
123124
124125 err = sqlConn .Ping ()
125126 if err != nil {
You can’t perform that action at this time.
0 commit comments