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 daprahamian committed Aug 13, 2019
1 parent f38e261 commit 41aba90
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 @@ -399,7 +399,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 41aba90

Please sign in to comment.