Skip to content

Commit

Permalink
Fix issue sidorares#711: close emitted before end
Browse files Browse the repository at this point in the history
The 'end' event (emitted by `stream.push(null)`) should always be emitted before the close event.
This fixes issue sidorares#711
  • Loading branch information
Congelli501 authored Oct 13, 2018
1 parent 6953856 commit ad92d20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/commands/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ class Query extends Command {
stream.emit('error', err); // Pass on any errors
});
this.on('end', function () {
stream.emit('close'); // notify readers that query has completed
stream.push(null); // pushing null, indicating EOF
stream.emit('close'); // notify readers that query has completed
});
this.on('fields', function (fields) {
stream.emit('fields', fields); // replicate old emitter
Expand Down

0 comments on commit ad92d20

Please # to comment.