From 9c5cd8d02db873877a96ba51a11b23ae8b310436 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 17 Mar 2014 18:51:32 +0100 Subject: [PATCH] Remove disconnected clients from the pool Might fix #458 Fixes https://github.com/CartoDB/CartoDB-SQL-API/issues/135 --- lib/pool.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/pool.js b/lib/pool.js index 9cf9aab..02e7ddb 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -33,6 +33,11 @@ var pools = { pool.destroy(client); }); + // Remove connection from pool on disconnect + client.on('end', function(e) { + pool.destroy(client); + }); + return cb(null, client); }); },