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

Commit

Permalink
fix(retryable-writes): network errors are retryable, inverted logic
Browse files Browse the repository at this point in the history
NODE-1105
  • Loading branch information
mbroadst committed Dec 1, 2017
1 parent 1efb35a commit 2727551
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/topologies/mongos.js
Original file line number Diff line number Diff line change
Expand Up @@ -900,15 +900,15 @@ var executeWriteOperation = function(self, op, ns, ops, options, callback) {

server[op](ns, ops, options, (err, result) => {
if (!err) return callback(null, result);
if (err instanceof errors.MongoNetworkError) {
if (!(err instanceof errors.MongoNetworkError)) {
return callback(err);
}

// Pick another server
server = pickProxy(self);

// No server found error out with original error
if (!server) {
if (!server || !isRetryableWritesSupported(server)) {
return callback(err);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/topologies/replset.js
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ var executeWriteOperation = function(self, op, ns, ops, options, callback) {

self.s.replicaSetState.primary[op](ns, ops, options, (err, result) => {
if (!err) return callback(null, result);
if (err instanceof errors.MongoNetworkError) {
if (!(err instanceof errors.MongoNetworkError)) {
return callback(err);
}

Expand Down

0 comments on commit 2727551

Please sign in to comment.