destroyAllNow also has a callback

This commit is contained in:
Ricky Ng-Adam 2014-04-17 16:25:59 +08:00
parent 382d6d66f9
commit 85c28e9088

View File

@ -25,11 +25,12 @@ PG.prototype.end = function() {
var pool = self.pools.all[key]; var pool = self.pools.all[key];
delete self.pools.all[key]; delete self.pools.all[key];
pool.drain(function() { pool.drain(function() {
pool.destroyAllNow(); pool.destroyAllNow(function() {
count--; count--;
if(count === 0) { if(count === 0) {
self.emit('ended'); self.emit('ended');
} }
});
}); });
}); });
}; };