Update database limits

pull/5/head
maru 2024-05-09 14:13:19 -04:00
parent 59ea469fb6
commit de0bd74dc2
No known key found for this signature in database
GPG Key ID: 37689350E9CD0F0D
1 changed files with 6 additions and 2 deletions

View File

@ -38,8 +38,12 @@ func Init(username, password, protocol, address, database string) error {
return fmt.Errorf("failed to open database connection: %s", err)
}
handle.SetMaxIdleConns(256)
handle.SetMaxOpenConns(256)
if protocol == "unix" {
handle.SetMaxOpenConns(1000)
} else {
handle.SetMaxOpenConns(200)
}
handle.SetConnMaxIdleTime(time.Second * 30)
handle.SetConnMaxLifetime(time.Minute)