Skip to content

Commit

Permalink
feat(topology-base): support passing callbacks to close method
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Mar 11, 2019
1 parent 08f15ab commit 7c111e0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/topologies/topology_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ class TopologyBase extends EventEmitter {
return this.s.coreTopology.connections();
}

close(forceClosed) {
close(forceClosed, callback) {
// If we have sessions, we want to individually move them to the session pool,
// and then send a single endSessions call.
if (this.s.sessions.length) {
Expand All @@ -390,9 +390,12 @@ class TopologyBase extends EventEmitter {
this.s.sessionPool.endAllPooledSessions();
}

this.s.coreTopology.destroy({
force: typeof forceClosed === 'boolean' ? forceClosed : false
});
this.s.coreTopology.destroy(
{
force: typeof forceClosed === 'boolean' ? forceClosed : false
},
callback
);

// We need to wash out all stored processes
if (forceClosed === true) {
Expand Down

0 comments on commit 7c111e0

Please sign in to comment.