From ba050c68e34900da8eaf3f5b7b9f3e2efe14f9c6 Mon Sep 17 00:00:00 2001 From: Vitaly Tomilov Date: Fri, 2 Jun 2017 05:08:08 +0100 Subject: [PATCH] Adding support for `isDestroyed` function This can be done without reliance on the `generic-pool`, by introducing an internal flag to be set when `.end()` is called. In this case the function can be replaced with a property, perhaps. Anyway, this one will work just fine for the moment. --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index aec3a1e..abc09dc 100644 --- a/index.js +++ b/index.js @@ -50,6 +50,10 @@ var Pool = module.exports = function (options, Client) { util.inherits(Pool, EventEmitter) +Pool.prototype.isDestroyed = function () { + return this.pool._draining +} + Pool.prototype._promise = function (cb, executor) { if (!cb) { return new this.Promise(executor)