From de0bd74dc258f380284c75723b4a4f49fccfc068 Mon Sep 17 00:00:00 2001 From: maru Date: Thu, 9 May 2024 14:13:19 -0400 Subject: [PATCH] Update database limits --- db/db.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/db/db.go b/db/db.go index e84f031..3ab8c87 100644 --- a/db/db.go +++ b/db/db.go @@ -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)