From 0a53d1cd17e365801e1128895a88bbda37646f04 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Tue, 4 Sep 2012 12:28:33 +0200 Subject: [PATCH] Make PSQL.end a no-op, to avoid breaking pooled clients. Closes #48 --- app/models/psql.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/psql.js b/app/models/psql.js index 39d784f7..5bb12bf9 100644 --- a/app/models/psql.js +++ b/app/models/psql.js @@ -76,8 +76,17 @@ var PSQL = function(user_id, db, limit, offset){ ); }; + /// @deprecated -- should not be called me.end = function(){ - this.client.end(); + // NOTE: clients created via the pg#connect method will be // automatically disconnected or placed back into the + // connection pool and should NOT have their #end + // method called + // REF: https://github.com/brianc/node-postgres/wiki/Client#method-end + // See me.connect() + + // if ( this.client ) { this.client.end(); this.client = null; } + + // NOTE: maybe provide a function resumeDrain, but change its name }; // little hack for UI