Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
lib: initial experimental AbortController implementation#33527
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
jasnell commented May 23, 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.
7544a2d to 29b247cComparebenjamingr commented May 23, 2020
That's awesome, I'm going to check this out and play with it asap. Also post it on the summit issue. |
lib/internal/abort_controller.js Outdated
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.
cc @mysticatea <3
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
benjamingr commented May 23, 2020
Other than test and review this is there anything I can do to help? |
jasnell commented May 23, 2020
One of the next steps is to identify a list of the existing Promise APIs in core that could by updated to make use of this. Not all of them will make sense because not all of them are abortable (e.g. libuv only allows us to cancel file system requests if they have not already been started, for instance). So while we may be able to use Additionally, we should make it possible for custom constsleep=promisify(setTimeout);constac=newAbortController();sleep(10000,ac);ac.abort();// Calls clearTimeout on abort |
benjamingr commented May 23, 2020
@jasnell I've split those tasks off into an issue here: #33528 - please feel free to edit that issue as you see fit. I will start working on these one by one (on weekends mostly) and add tasks as I find them. Feel free to edit it. I want to be clear that I want to be helpful here so since you took the initiative if at any point any of the things I'm doing are frustrating just tell me and I'll stop and do whatever is helpful to the effort instead. These sorts of ongoing efforts tend to become frustrating in Node.js at times, I want to be sure that I'm not doing any toe-stepping if I can help it. |
jasnell commented May 25, 2020
Initial implementation of |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
02953f1 to 7290192Comparejasnell commented May 26, 2020
Updated based on the #33556 |
jasnell commented May 26, 2020
@benjamingr ... quick note... this is currently extending from |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
See documentation changes for details Signed-off-by: James M Snell <[email protected]> PR-URL: #33556 Refs: #33527 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Bradley Farias <[email protected]>
a7b3dd8 to 890a585Comparejasnell commented May 28, 2020
Marking this ready for review. This does create a new global so technically may be semver-major but I have tested it with existing ecosystem polyfills and haven't seen any breakage at all. Unless there are objections from the @nodejs/tsc, I'd like to handle this as a semver-minor. It is still experimental and an experimental warning will be emitted the first time an |
AbortController impl based very closely on:
https://github.com/mysticatea/abort-controller
Marked experimental.
Global (writable, configurable)
Not currently used by any of the existing promise apis.
AbortSignalextends fromEventEmitterinstead ofEventTarget.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes