Skip to content

Commit

Permalink
fix(change_stream): emit 'close' event if reconnecting failed
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 authored and mbroadst committed Jul 24, 2019
1 parent 15d69c8 commit f24c084
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/change_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,11 @@ function processNewChange(args) {
// attempt recreating the cursor
if (eventEmitter) {
waitForTopologyConnected(topology, { readPreference: options.readPreference }, err => {
if (err) return changeStream.emit('error', err);
if (err) {
changeStream.emit('error', err);
changeStream.emit('close');
return;
}
changeStream.cursor = createChangeStreamCursor(changeStream);
});

Expand Down

0 comments on commit f24c084

Please sign in to comment.