-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stream: when value is already in buffer don't emit the next one #46813
Conversation
Review requested:
|
I don't understand what this is trying to solve. |
The bug that this PR fixes |
@@ -267,7 +267,7 @@ function constructNT(stream) { | |||
} else if (err) { | |||
errorOrDestroy(stream, err, true); | |||
} else { | |||
process.nextTick(emitConstructNT, stream); | |||
emitConstructNT(stream); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the issue, @ronag I see you added this code, is there a purpose for the next tick?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still trying to understand why it was fixed... race condition between who?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think #46765 (comment) is the correct fix.
Thanks @ronag. Closing my PR in favor of |
fix #46765
this is probably not the best solution, I would like to know if there is a better one.
The problem happens because when getting a second value and:
returns
false
, so we write the second value withstream._write
, and thenclearBuffer
is called which emits the restthis PR is not ready to be merged, I did not set it as draft so I would be able to run tests