-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
feat(core): support AbortSignal in readFile #10943
Conversation
Let me know if there is anything else I should change here - if this is fine I'll go ahead and open PRs for some of the other APIs |
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.
Awesome! The implementation looks great. Just confirming the semantics here:
- Initiating a readFile with an already aborted abort signal immediately (no microtask delay) rejects the returned promise.
- Aborting a readFile that is completed already (returned promise is resolved) does nothing.
- If the promise returned from readFile is still pending and the operation is aborted, the readFile call will always reject with an abort error, even if the read completes in the same event loop cycle.
Also we'll have to wait with landing until the 1.12 merge window opens in a couple of days. I want to get another review from @bartlomieju before merging though.
That sounds very reasonable to me and is "regular" promise semantics - the promise should be rejected immediately but reacting to that rejection will always happen after a microtick. (That is,
I think the behaviour should be the same as
That's also my expectation though I'd find returning the fulfilled promise also acceptable - cancellation is "best effort" semantics.
That sounds fine to me - I'll wait for that and then follow up with other APIs then. |
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. Requesting additional reviews from @ry, @piscisaureus, @kitsonk, or @bartlomieju because it touches a public API.
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 - thank you @benjamingr
Thanks, I will follow up with PRs for the other APIs :) |
See discussion in #10181
cc @lucacasonato