From 2ccf0c4e57a97e8331b75b2e3f26a3f8d2375f62 Mon Sep 17 00:00:00 2001 From: Polawat Phetra Date: Thu, 12 Apr 2012 13:40:00 +0700 Subject: [PATCH] pool size can be pass via configuration --- lib/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index ac2991e2f..c7082aece 100644 --- a/lib/index.js +++ b/lib/index.js @@ -43,6 +43,10 @@ PG.prototype.connect = function(config, callback) { if(pool) return pool.acquire(cb); + var poolSize = defaults.poolSize; + if (c.poolSize) { + poolSize = c.poolSize; + } var pool = pools[poolName] = genericPool.Pool({ name: poolName, create: function(callback) { @@ -75,7 +79,7 @@ PG.prototype.connect = function(config, callback) { destroy: function(client) { client.end(); }, - max: defaults.poolSize, + max: poolSize, idleTimeoutMillis: defaults.poolIdleTimeout, reapIntervalMillis: defaults.reapIntervalMillis });