Specify connection limits for mysql kv store backend

This commit is contained in:
Tobie Morgan Hitchcock 2018-05-01 15:45:11 +01:00
parent 47e1a4aceb
commit f1fa311d3b

View file

@ -15,6 +15,8 @@
package mysql
import (
"time"
"strings"
"crypto/tls"
@ -68,6 +70,20 @@ func init() {
return
}
// Set the maximum connection lifetime
pntr.SetConnMaxLifetime(1 * time.Hour)
// Set the max number of idle connections
pntr.SetMaxIdleConns(350)
// Set the max number of open connections
pntr.SetMaxOpenConns(350)
// Return the database pointer
return &DB{pntr: pntr}, err
})