Specify connection limits for mysql kv store backend
This commit is contained in:
parent
47e1a4aceb
commit
f1fa311d3b
1 changed files with 16 additions and 0 deletions
|
@ -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
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue