(cb)
| 486 | } |
| 487 | |
| 488 | end(cb) { |
| 489 | this.log('ending') |
| 490 | if (this.ending) { |
| 491 | const err = new Error('Called end on pool more than once') |
| 492 | return cb ? cb(err) : this.Promise.reject(err) |
| 493 | } |
| 494 | this.ending = true |
| 495 | const promised = promisify(this.Promise, cb) |
| 496 | this._endCallback = promised.callback |
| 497 | this._pulseQueue() |
| 498 | return promised.result |
| 499 | } |
| 500 | |
| 501 | get waitingCount() { |
| 502 | return this._pendingQueue.length |