Set max open MariaDB connections
parent
1ea2829f63
commit
54d4d9a389
6
db/db.go
6
db/db.go
|
@ -10,12 +10,14 @@ import (
|
||||||
var handle *sql.DB
|
var handle *sql.DB
|
||||||
|
|
||||||
func Init(username, password, protocol, address, database string) error {
|
func Init(username, password, protocol, address, database string) error {
|
||||||
db, err := sql.Open("mysql", username+":"+password+"@"+protocol+"("+address+")/"+database)
|
var err error
|
||||||
|
|
||||||
|
handle, err = sql.Open("mysql", username+":"+password+"@"+protocol+"("+address+")/"+database)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to open database connection: %s", err)
|
return fmt.Errorf("failed to open database connection: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = db
|
handle.SetMaxOpenConns(1000)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue