1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

Ability to configure number of db connections.

This commit is contained in:
Ferdinand Mütsch 2019-10-11 10:03:18 +02:00
parent 9b17cde420
commit f3fe8124c8

View File

@ -79,11 +79,10 @@ func main() {
// Connect to database
db, err := gorm.Open(config.DbDialect, utils.MakeConnectionString(config))
db.LogMode(false)
db.DB().SetMaxIdleConns(1)
db.DB().SetMaxOpenConns(10)
db.DB().SetMaxIdleConns(int(config.DbMaxConn))
db.DB().SetMaxOpenConns(int(config.DbMaxConn))
if err != nil {
// log.Fatal("Could not connect to database.")
log.Fatal(err)
log.Fatal("Could not connect to database.")
}
defer db.Close()