From 8a677a2130b147869a87048482023a82e36d8886 Mon Sep 17 00:00:00 2001 From: nochill Date: Wed, 27 Sep 2023 21:57:21 +0700 Subject: [PATCH] set max db connection --- main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.go b/main.go index 68c0774..0f8b41f 100644 --- a/main.go +++ b/main.go @@ -24,6 +24,10 @@ func main() { log.Fatal("cannot connect to db: ", err) } + // limit db connection + dbConn.SetConnMaxLifetime(100) + dbConn.SetMaxOpenConns(100) + store := db.NewStore(dbConn) server, err := api.NewServer(config, store) if err != nil {