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

Commit 1394e668 by Meg Sharkey

don't destroy connection until client is finished

1 parent 26f76ba1
Showing with 14 additions and 3 deletions
......@@ -50,9 +50,20 @@ module.exports = (function() {
ConnectorManager.prototype.disconnect = function() {
var self = this
this.client.end(function() {
// needed to prevent mysql connection leak
self.client.destroy()
self.client = null
var intervalObj = null
var cleanup = function () {
var retryCt = 0
// make sure to let client finish before calling destroy
if (!self.hasNoConnections) {
return
}
// needed to prevent mysql connection leak
self.client.destroy()
self.client = null
clearInterval(intervalObj)
}
intervalObj = setInterval(cleanup, 10)
cleanup()
})
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!