| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Also, with the addition of the AsyncResource in the *SyncAndReturn methods, I'm not convinced we still need separate sync and async methods. |
Sorry, something went wrong.
There was a problem hiding this comment.
Couple comments, also, I am afraid this comes with a perf cost in the *SyncAndReturn(...) methods
Sorry, something went wrong.
|
Yes, there would be some perf cost to the AsyncResource, however it's the more correct way to handle this and the perf impact should be fairly minimal as AsyncResource skips the native side of async_hooks, instead just calling the lifecycle handlers directly.. |
Sorry, something went wrong.
Because of _propagate that would still mean that the perf impact of calling it grows with the current number of active instances of AsyncLocalStorage. I'd prefer to avoid calling the init hook alltogether in the sync track. |
Sorry, something went wrong.
|
This PR was aimed to fix nested .run*() calls problem discussed here: #31945 (comment) Yet, I don't see any tests that verify the fix. |
Sorry, something went wrong.
|
No it wasn't, I made this as an improvement not as a fix. I can rework it to verify that it fixes that too though, if you want, as it probably does. |
Sorry, something went wrong.
|
Added a test to verify it fixes that issue. |
Sorry, something went wrong.
|
I restored the _exit method as the PR is not really about that anymore. Also, what do you all think about just making the *SyncAndReturn methods into the base methods and eliminating the existing run and exit? They are somewhat redundant as they are functionally pretty much the same with the AsyncResource in there. The only difference being the callback is not actually executed async, which I don't think actually matters. If anything, I'd find it a bit unexpected that they are async by default. It's similar to the function given to a new Promise, in my opinion. 🤔 |
Sorry, something went wrong.
I like the idea of keeping only a single pair of methods. But I'd rather rename *SyncAndReturn into run and exit and update their documentation. It doesn't make sense to use longer names when there are no alternative methods. |
Sorry, something went wrong.
|
@Qard I don't really understand the benchmarks, did you delete one message? Also, if I understand well, we still introduce a perf impact on the sync path that grows with the number of concurent instances. I'd like to avoid this case. |
Sorry, something went wrong.
|
Yes, I deleted a comment awhile ago as I ran the benchmark wrong. The correct benchmark is the one in the thread near the top of the PR. It shows that the performance difference is basically non-existent. |
Sorry, something went wrong.
|
Rebased as #31930 has landed now. |
Sorry, something went wrong.
|
Probably worth waiting for #31998 to land first |
Sorry, something went wrong.
|
Marked this one with semver-minor label, as it shouldn't land in a patch release. Let me know if you don't feel the same. |
Sorry, something went wrong.
PR-URL: nodejs#31950 Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
|
Sounds fine to me. 👍 |
Sorry, something went wrong.
`runSyncAndReturn` was removed from Node.js in nodejs/node#31950
PR-URL: nodejs#31950 Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
PR-URL: nodejs#31950 Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
PR-URL: #31950 Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
PR-URL: #31950 Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Notable Changes:
* async_hooks**:
* Merge `run` and `exit` methods (Andrey Pechkurov)
#31950
* Prevent sync methods of async storage exiting outer context
(Stephen Belanger)
#31950
* vm:
* Add `importModuleDynamically` option to compileFunction (Gus
Caplan)
#32985
New core collaborators:
With this release, we welcome two new Node.js core collaborators:
* Juan José Arboleda @juanarbol
#32906
* Andrey Pechkurov @puzpuzpuz
#32817
PR-URL: #33122
PR-URL: #31950 Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
PR-URL: #31950 Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Notable Changes:
* async_hooks**:
* Merge `run` and `exit` methods (Andrey Pechkurov)
#31950
* Prevent sync methods of async storage exiting outer context
(Stephen Belanger)
#31950
* vm:
* Add `importModuleDynamically` option to compileFunction (Gus
Caplan)
#32985
New core collaborators:
With this release, we welcome two new Node.js core collaborators:
* Juan José Arboleda @juanarbol
#32906
* Andrey Pechkurov @puzpuzpuz
#32817
PR-URL: #33122
Notable Changes:
* async_hooks**:
* Merge `run` and `exit` methods (Andrey Pechkurov)
#31950
* Prevent sync methods of async storage exiting outer context
(Stephen Belanger)
#31950
* vm:
* Add `importModuleDynamically` option to compileFunction (Gus
Caplan)
#32985
New core collaborators:
With this release, we welcome two new Node.js core collaborators:
* Juan José Arboleda @juanarbol
#32906
* Andrey Pechkurov @puzpuzpuz
#32817
PR-URL: #33122
|
@Qard Sorry if I misunderstand something, but was this merged only to 12.x but not to 14.x? |
Sorry, something went wrong.
|
@kibertoad a683e87 is the commit that landed on 14.x branch and is released with v14.0.0. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
The _exit logic is not actually necessary as explained here. This eliminates it and gives sync context runs a proper AsyncResource.
cc @vdeturckheim @puzpuzpuz @Flarna
Checklist