Skip to content

Commit

Permalink
force draining pools
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-contreras-deel committed Aug 20, 2020
1 parent 8476670 commit e74f3d6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ module.exports = class RedisPool extends EventEmitter {
}
}

/**
* Closing all connection pools
*
* https://github.com/coopernurse/node-pool/blob/v3.7.1/README.md#draining
*/
async drain () {
await Promise.all(Object.values(this.pools).map(p => p.drain().then(() => p.clear())) )
}

_addCommands () {
if (this.options.commands.length) {
this.options.commands.forEach(newCommand => redis.add_command(newCommand));
Expand Down

0 comments on commit e74f3d6

Please sign in to comment.