Browse Source

simple refactoring

pull/645/head
Chris Lu 7 years ago
parent
commit
94a35f25f3
  1. 7
      weed/filer/postgres_store/postgres_native.go

7
weed/filer/postgres_store/postgres_native.go

@ -94,17 +94,12 @@ func getDbConnection(conf PostgresConf) *sql.DB {
panic(pingErr) panic(pingErr)
} }
var maxIdleConnections, maxOpenConnections int
maxIdleConnections, maxOpenConnections := default_maxIdleConnections, default_maxOpenConnections
if conf.MaxIdleConnections != 0 { if conf.MaxIdleConnections != 0 {
maxIdleConnections = conf.MaxIdleConnections maxIdleConnections = conf.MaxIdleConnections
} else {
maxIdleConnections = default_maxIdleConnections
} }
if conf.MaxOpenConnections != 0 { if conf.MaxOpenConnections != 0 {
maxOpenConnections = conf.MaxOpenConnections maxOpenConnections = conf.MaxOpenConnections
} else {
maxOpenConnections = default_maxOpenConnections
} }
_db_connection.SetMaxIdleConns(maxIdleConnections) _db_connection.SetMaxIdleConns(maxIdleConnections)

Loading…
Cancel
Save