Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
stream: add catch handler for async _construct#34416
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
Add a catch handler for `async _construct()` for Streams.
nodejs-github-bot commented Jul 17, 2020
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
mcollina left a comment
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.
lgtm
ronag commented Jul 18, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
If we do this for construct I think we should do it for |
Uh oh!
There was an error while loading. Please reload this page.
jasnell commented Jul 20, 2020
Pulling the |
jasnell commented Jul 20, 2020
Ok, @ronag, @mcollina, @addaleax, and @antsmartian ... please take another look As suggested by @ronag, this implements async function support for As @ronag suspected, the performance hit of implementing this for |
addaleax commented Jul 20, 2020
This still LGTM, but I kind of wish we could reduce code duplication a bit here… |
jasnell commented Jul 20, 2020
Yeah, I plan to take a second pass through with that in mind. I did it this way to minimize impact on any existing code. There are some timing differences in the Promise handler versions (deferrals to nextTick) that do not always work in the existing cases. Because of that, I wanted to focus first on making it work, then on reducing duplication later. |
ronag commented Jul 20, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I like this... but I’m kind of unsure if we actually need this... especially if it’s non-trivial |
jasnell commented Jul 20, 2020
Need, possibly not, no more than we need |
addaleax commented Jul 20, 2020
I, for one, would really love to not ever need to write callback-based streams code again :) |
nodejs-github-bot commented Jul 20, 2020
ronag commented Jul 20, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I'm not sure I understand the need for the code duplication? Shouldn't this be a trivial case of: functionfn(){// ...}constthenable=this._construct(fn)if(typeofthenable?.then==='function'){thenable.then((val)=>fn(null,val),(err)=>fn(err))}Where |
jasnell commented Jul 20, 2020
For some cases, yes, in others, no, not without modifying the existing callbacks, which I don't want to do in this PR. I plan to eliminate / reduce the duplication by modifying the existing callbacks separately, once I can verify that there's no backwards compat issues |
mcollina left a comment
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'll need some time to review this.
Can we check benchmarks to see if this this regress stuff? I don't expect it to, but this is complex code.
jasnell commented Jul 21, 2020
Taking |
jasnell commented Jul 21, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/649/ @mcollina... no performance change with these modifications |
jasnell commented Jul 31, 2020
Ping @mcollina |
mcollina left a comment
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.
lgtm, good work!
nodejs-github-bot commented Aug 3, 2020
nodejs-github-bot commented Aug 4, 2020
PR-URL: #34416 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anto Aravinth <[email protected]>
jasnell commented Aug 4, 2020
Landed in 744a284 |
addaleax commented Aug 8, 2020
@jasnell This would need a manual backport for v14.x, there’s a bunch of conflicts |
Add a catch handler for
async _construct()for Streams.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes