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

Commit e8cbc7de by Dmitry Chornyi

Refactored pool.destroy

1 parent 63ac4704
Showing with 7 additions and 10 deletions
......@@ -68,6 +68,13 @@ module.exports = (function() {
return this.write.release(client);
}
},
destroy: function (client) {
if (client.queryType == 'read') {
return this.read.destroy(client);
} else {
return this.write.destroy(client);
}
},
acquire: function (callback, priority, queryType) {
if (queryType == 'SELECT') {
this.read.acquire(callback, priority);
......@@ -347,17 +354,7 @@ module.exports = (function() {
if (err.code !== 'PROTOCOL_CONNECTION_LOST') {
throw err
}
if (typeof(pool.destroy) == 'function') {
pool.destroy(client)
} else {
if (client.queryType == 'read' && pool.read && typeof(pool.read.destroy) == 'function') {
pool.read.destroy(client)
}
if (client.queryType == 'write' && pool.write && typeof(pool.write.destroy) == 'function') {
pool.write.destroy(client)
}
}
})
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!