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:
parent
9b17cde420
commit
f3fe8124c8
7
main.go
7
main.go
@ -79,11 +79,10 @@ func main() {
|
|||||||
// Connect to database
|
// Connect to database
|
||||||
db, err := gorm.Open(config.DbDialect, utils.MakeConnectionString(config))
|
db, err := gorm.Open(config.DbDialect, utils.MakeConnectionString(config))
|
||||||
db.LogMode(false)
|
db.LogMode(false)
|
||||||
db.DB().SetMaxIdleConns(1)
|
db.DB().SetMaxIdleConns(int(config.DbMaxConn))
|
||||||
db.DB().SetMaxOpenConns(10)
|
db.DB().SetMaxOpenConns(int(config.DbMaxConn))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// log.Fatal("Could not connect to database.")
|
log.Fatal("Could not connect to database.")
|
||||||
log.Fatal(err)
|
|
||||||
}
|
}
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user