Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃殌 AbortController in Node task list #33528

Closed
5 tasks
benjamingr opened this issue May 23, 2020 · 8 comments
Closed
5 tasks

馃殌 AbortController in Node task list #33528

benjamingr opened this issue May 23, 2020 · 8 comments

Comments

@benjamingr
Copy link
Member

benjamingr commented May 23, 2020

Hey,

James started a PR at #33527 and we're having a summit meeting in openjs-foundation/summit#273 regarding adding AbortController to core.

Other than checking out the code and testing it (please do) James listed some work items in that PR when I asked and I figured it would be nice to have a list of them here.

This list is mutable. While our process is typically that collaborators don't edit each other's posts - you are welcome to add/remove/edit this list (please do!) as you see fit:

  • Core APIs:
  • Figure out how util.promisify should support cancellation, and if it does what that API should look like.
  • Figure out how to have good/debuggable AbortErrors when things go wrong.
@benjamingr
Copy link
Member Author

Starting to work on an Initial list of core APIs that can utilize AbortController. Please feel free to edit this everyone.

@benjamingr
Copy link
Member Author

@jasnell hey just to understand, are you interested in only supporting the promise (or promisifed) versions of the APIs (at least initially) or would you like to also explore adding it to the callback versions?

(Inb4: doing one or the other does not preclude us from doing one or the other in the future)

@jasnell
Copy link
Member

jasnell commented May 23, 2020

Supporting on callback versions is certainly possible and would likely help make things more consistent.

@Bnaya
Copy link

Bnaya commented May 23, 2020

We need to also think about abort detection,
In the browser fetch there's very vague AbortError which is DOMException with name="AbortError",
And the protocol is kinda error instanceof Error && error.name === "AbortError"
There is no direct constructor for that error
Minimal code to get it:

c = new AbortController()
p = fetch('', {signal: c.signal}).catch(e => e)
c.abort()
abortError = await p;
console.log(abortError, abortError.name, abortError.message)

@benjamingr
Copy link
Member Author

@Bnaya thanks, I added it to the list, feel free to spin up a document and bikeshed there - it's not like it's half of what we do together in our 9-5 anyway :D

@benjamingr
Copy link
Member Author

@ptomato would either of you be interested in taking the API bikeshedding part?

I went over some APIs? (I'm trying to figure for what APIs it makes sense but probably not how it would look like). Error are also interesting to discuss

@ptomato
Copy link

ptomato commented May 25, 2020

@ptomato would either of you be interested in taking the API bikeshedding part?

Yes, definitely. I had actually already started on that for myself. There is some proof of concept in https://github.com/ptomato/node/commits/31971-abortcontroller . I don't have much time to work on it this week, but next week I can continue.

@benjamingr
Copy link
Member Author

This has been superseded and stalled so I'm closing. The usual "if anyone feels strongly - feel free to reopen" :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants