From 09aca2528a8c1fd13bb9ebedbda86154afb94cce Mon Sep 17 00:00:00 2001 From: slene Date: Sun, 22 Sep 2013 17:51:37 +0800 Subject: [PATCH] orm RegisterDataBase remove default maxIdle/maxConn --- orm/db_alias.go | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/orm/db_alias.go b/orm/db_alias.go index 44f55681..568a3b24 100644 --- a/orm/db_alias.go +++ b/orm/db_alias.go @@ -9,9 +9,6 @@ import ( "time" ) -const defaultMaxIdleConns = 30 -const defaultMaxOpenConns = 50 - type DriverType int const ( @@ -92,18 +89,6 @@ type alias struct { // Setting the database connect params. Use the database driver self dataSource args. func RegisterDataBase(aliasName, driverName, dataSource string, params ...int) { - maxIdleConns := defaultMaxIdleConns - maxOpenConns := defaultMaxOpenConns - - for i, v := range params { - switch i { - case 0: - maxIdleConns = v - case 1: - maxOpenConns = v - } - } - al := new(alias) al.Name = aliasName al.DriverName = driverName @@ -173,8 +158,14 @@ func RegisterDataBase(aliasName, driverName, dataSource string, params ...int) { } } - SetMaxIdleConns(al.Name, maxIdleConns) - SetMaxOpenConns(al.Name, maxOpenConns) + for i, v := range params { + switch i { + case 0: + SetMaxIdleConns(al.Name, v) + case 1: + SetMaxOpenConns(al.Name, v) + } + } err = al.DB.Ping() if err != nil {