Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Commit

Permalink
fix(sessions): actually allow ending of sessions
Browse files Browse the repository at this point in the history
Currently, endSessions filters out any calls that happen while
the topology is connected. However, it is impossible to send
an endSessions command if you are not connected. This fix allows
sessions to be ended while the topology is connected

Part of HELP-5834
  • Loading branch information
daprahamian committed Feb 23, 2018
1 parent 2d3fa98 commit 2b81bb6
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lib/topologies/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,6 @@ function resolveClusterTime(topology, $clusterTime) {
// to share code.
const SessionMixins = {
endSessions: function(sessions, callback) {
if (this.isConnected()) {
if (typeof callback === 'function') callback();
return;
}

if (!Array.isArray(sessions)) {
sessions = [sessions];
}
Expand All @@ -395,7 +390,7 @@ const SessionMixins = {
// Is it enough to use: ReadPreference.primaryPreferred ?
this.command(
'admin.$cmd',
{ endSessions: sessions.map(s => s.id) },
{ endSessions: sessions },
{ readPreference: ReadPreference.primaryPreferred },
() => {
// intentionally ignored, per spec
Expand Down

0 comments on commit 2b81bb6

Please sign in to comment.