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

Commit 1394e668 by Meg Sharkey

don't destroy connection until client is finished

1 parent 26f76ba1
Showing with 11 additions and 0 deletions
...@@ -50,9 +50,20 @@ module.exports = (function() { ...@@ -50,9 +50,20 @@ module.exports = (function() {
ConnectorManager.prototype.disconnect = function() { ConnectorManager.prototype.disconnect = function() {
var self = this var self = this
this.client.end(function() { this.client.end(function() {
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 // needed to prevent mysql connection leak
self.client.destroy() self.client.destroy()
self.client = null 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!