Skip to content

Commit

Permalink
fix(replset): destroy servers that are removed during SDAM flow
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Oct 15, 2019
1 parent 63fbdee commit 9ea0190
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/core/topologies/replset_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ ReplSetState.prototype.update = function(server) {
removeFrom(server, self.unknownServers);

// Destroy the instance
server.destroy();
server.destroy({ force: true });

// Set the type of topology we have
if (this.primary && !this.primary.equals(server)) {
Expand Down Expand Up @@ -555,7 +555,7 @@ ReplSetState.prototype.update = function(server) {
// Signal primary left
self.emit('left', 'primary', this.primary);
// Destroy the instance
self.primary.destroy();
self.primary.destroy({ force: true });
// Set the new instance
self.primary = server;
// Set the set information
Expand Down Expand Up @@ -607,7 +607,7 @@ ReplSetState.prototype.update = function(server) {

// Remove primary
if (this.primary && this.primary.name.toLowerCase() === serverName) {
server.destroy();
server.destroy({ force: true });
this.primary = null;
self.emit('left', 'primary', server);
}
Expand Down Expand Up @@ -659,7 +659,7 @@ ReplSetState.prototype.update = function(server) {

// Remove primary
if (this.primary && this.primary.name.toLowerCase() === serverName) {
server.destroy();
server.destroy({ force: true });
this.primary = null;
self.emit('left', 'primary', server);
}
Expand All @@ -674,7 +674,7 @@ ReplSetState.prototype.update = function(server) {
//
if (this.set[serverName] && this.set[serverName].type === ServerType.RSPrimary) {
self.emit('left', 'primary', this.primary);
this.primary.destroy();
this.primary.destroy({ force: true });
this.primary = null;
this.topologyType = TopologyType.ReplicaSetNoPrimary;
return false;
Expand Down

0 comments on commit 9ea0190

Please sign in to comment.