fix for #90, multiple destroy calls are successful

This commit is contained in:
Tim Griesser 2013-10-14 07:23:46 -04:00
parent 2ec64f6dd6
commit f23e24c7fb

View File

@ -80,10 +80,14 @@ define(function(require, exports) {
// Tear down the pool, only necessary if you need it.
destroy: function(callback) {
var poolInstance = this.poolInstance;
if (poolInstance) {
poolInstance.drain(function() {
poolInstance.destroyAllNow(callback);
});
delete this.poolInstance;
} else {
callback();
}
return this;
}