From 3489ae91bf87c77687e36329d389be2c0534d2d3 Mon Sep 17 00:00:00 2001 From: maru Date: Fri, 24 May 2024 01:32:33 -0400 Subject: [PATCH] Change max connections code again --- db/db.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/db/db.go b/db/db.go index 359beb2..0e21c9c 100644 --- a/db/db.go +++ b/db/db.go @@ -21,7 +21,6 @@ import ( "database/sql" "fmt" "log" - "time" _ "github.com/go-sql-driver/mysql" ) @@ -36,12 +35,10 @@ func Init(username, password, protocol, address, database string) error { return fmt.Errorf("failed to open database connection: %s", err) } - conns := 128 + conns := 64 handle.SetMaxOpenConns(conns) - handle.SetMaxIdleConns(conns / 4) - - handle.SetConnMaxIdleTime(time.Second * 10) + handle.SetMaxIdleConns(conns) tx, err := handle.Begin() if err != nil {