Set max open MariaDB connections

pull/4/head
maru 7 months ago
parent 1ea2829f63
commit 54d4d9a389
No known key found for this signature in database
GPG Key ID: 37689350E9CD0F0D

@ -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…
Cancel
Save