-
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
lib: refactor transferable AbortSignal #43388
Conversation
The use of makeTransferable on all AbortSignal instances made creating them always slow, causing bottlenecks in stuff like Web Streams. This refactors that so that AbortSignals are not transferable by default, which is actually the correct standard behavior anyway. A new transferableAbortSignal and transferableAbortController utility is provided to enable the transferable use case. Signed-off-by: James M Snell <jasnell@gmail.com>
Note the failing tests |
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
<!-- | ||
added: REPLACEME | ||
--> | ||
|
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.
> Stability: 1 - Experimental | |
<!-- | ||
added: REPLACEME | ||
--> | ||
|
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.
> Stability: 1 - Experimental | |
* }} [init] | ||
* @returns {AbortSignal} | ||
*/ | ||
function createAbortSignal(init) { |
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.
function createAbortSignal(init) { | |
function createAbortSignal(init = kEmptyObject) { |
and then requiring kEmptyObject
from internal/util
will probably fix the test failures. You might also want to rebase to include the change from #43159 for this to work.
Superseded by #44048 |
The use of makeTransferable on all AbortSignal instances made creating them always slow,
causing bottlenecks in stuff like Web Streams. This refactors that so that AbortSignals
are not transferable by default, which is actually the correct standard behavior anyway.
A new transferableAbortSignal and transferableAbortController utility is provided to
enable the transferable use case.
Signed-off-by: James M Snell jasnell@gmail.com
Fixes: #43160
/cc @mcollina @ronag