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

Commit 43e9b23

Browse files
vkarpov15mbroadst
authored andcommitted
fix(cursor): avoid waiting for reconnect if reconnect disabled
1 parent 611a352 commit 43e9b23

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/cursor.js

+6
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,12 @@ var nextFunction = function(self, callback) {
575575
// Topology was destroyed, so don't try to wait for it to reconnect
576576
return callback(new MongoError('Topology was destroyed'));
577577
}
578+
579+
if (!self.s.topologyOptions.reconnect) {
580+
// Reconnect is disabled, so we'll never reconnect
581+
return callback(new MongoError('no connection available'));
582+
}
583+
578584
return self.disconnectHandler.addObjectAndMethod(
579585
'cursor',
580586
self,

0 commit comments

Comments
 (0)