不要怂,就是干,撸起袖子干!

Commit 1c8fbbee by José Moreira

add `.destroy` proxy method into CM

1 parent 0d4f37bd
......@@ -113,6 +113,9 @@ ConnectionManager.prototype.initPools = function () {
self.pool.write.acquire(callback, priority);
}
},
destroy: function(connection) {
return self.pool[connection.queryType].destroy(connection);
},
drain: function() {
self.pool.read.drain();
self.pool.write.drain();
......
......@@ -67,12 +67,8 @@ ConnectionManager.prototype.connect = function(config) {
// See [stackoverflow answer](http://stackoverflow.com/questions/20210522/nodejs-mysql-error-connection-lost-the-server-closed-the-connection)
connection.on('error', function (err) {
if (err.code === 'PROTOCOL_CONNECTION_LOST') {
// Get the right read/write pool in case of replication, otherwise use generic pool
var pool = config.replication ? self.pool[connection.queryType] : self.pool;
// Remove it from read/write pool
pool.destroy(connection);
self.pool.destroy(connection);
}
});
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!