Skip to content

Commit

Permalink
feat(mysql setup): change mysql connection pool setup
Browse files Browse the repository at this point in the history
  • Loading branch information
yussan committed Aug 9, 2024
1 parent 3bdb0d2 commit f787109
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions storages/db/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"ki-be/configs"
"log"
"time"

"github.com/jinzhu/gorm"
)
Expand Down Expand Up @@ -32,5 +33,9 @@ func ConnectDB() *gorm.DB {
log.Panic(err)
}

DB.DB().SetMaxIdleConns(20)
DB.DB().SetMaxOpenConns(200)
DB.DB().SetConnMaxLifetime(time.Hour)

return DB
}

0 comments on commit f787109

Please # to comment.