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

Commit

Permalink
fix(cursor): avoid waiting for reconnect if reconnect disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 authored and mbroadst committed Oct 12, 2017
1 parent 611a352 commit 43e9b23
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,12 @@ var nextFunction = function(self, callback) {
// Topology was destroyed, so don't try to wait for it to reconnect
return callback(new MongoError('Topology was destroyed'));
}

if (!self.s.topologyOptions.reconnect) {
// Reconnect is disabled, so we'll never reconnect
return callback(new MongoError('no connection available'));
}

return self.disconnectHandler.addObjectAndMethod(
'cursor',
self,
Expand Down

0 comments on commit 43e9b23

Please sign in to comment.