mirror of
https://github.com/knex/knex.git
synced 2025-09-23 15:14:19 +00:00
fix for #90, multiple destroy calls are successful
This commit is contained in:
parent
2ec64f6dd6
commit
f23e24c7fb
@ -80,10 +80,14 @@ define(function(require, exports) {
|
|||||||
// Tear down the pool, only necessary if you need it.
|
// Tear down the pool, only necessary if you need it.
|
||||||
destroy: function(callback) {
|
destroy: function(callback) {
|
||||||
var poolInstance = this.poolInstance;
|
var poolInstance = this.poolInstance;
|
||||||
|
if (poolInstance) {
|
||||||
poolInstance.drain(function() {
|
poolInstance.drain(function() {
|
||||||
poolInstance.destroyAllNow(callback);
|
poolInstance.destroyAllNow(callback);
|
||||||
});
|
});
|
||||||
delete this.poolInstance;
|
delete this.poolInstance;
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user