limit db pool
This commit is contained in:
parent
510fd216e1
commit
0a1464fd4c
7
main.go
7
main.go
|
@ -14,7 +14,10 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION = "0.1"
|
const (
|
||||||
|
VERSION = "0.1"
|
||||||
|
MAX_DB_CONNS = 10 // already excessive for personal app
|
||||||
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Sql struct {
|
Sql struct {
|
||||||
|
@ -65,6 +68,8 @@ func dbConnect() {
|
||||||
fmt.Println("DB Error on Ping(): ", err)
|
fmt.Println("DB Error on Ping(): ", err)
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db.SetMaxIdleConns(MAX_DB_CONNS)
|
||||||
}
|
}
|
||||||
|
|
||||||
func initTemplates() {
|
func initTemplates() {
|
||||||
|
|
Loading…
Reference in New Issue