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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Abort all tasks in Node API #51

Open
tobiastom opened this issue Jun 23, 2016 · 6 comments
Open

Feature request: Abort all tasks in Node API #51

tobiastom opened this issue Jun 23, 2016 · 6 comments

Comments

@tobiastom
Copy link

I'm trying to use the Node API to keep some tasks running in the background, while other tasks are performed. Once the other tasks are finished, I'd like to abort all promises which did not finish.

It looks like there is the abortTasks function, but it's not exposed as a public API.

It would be nice if that could be changed. :)

@mysticatea
Copy link
Owner

mysticatea commented Jun 24, 2016

Thank you for this issue!

Sounds reasonable.
I need to check the direction of standard cancelable promise proposal in order to think proper API.
https://github.com/tc39/proposals#readme

@tobiastom
Copy link
Author

I fear there is no standard for it…

Thanks for considering it!

@mysticatea
Copy link
Owner

Sadly, the standard of cancelable promises has been withdrawn 😢 .
I will consider my own spec.

tc39/proposals@37e3c5a

@JoshuaKGoldberg
Copy link
Contributor

I don't think we need to use Promise cancellations for this one. Seems a little extreme and not backwards-compatible.

How about keeping a list of processes that are running, and providing a way to exit/kill them all?

@TehShrike
Copy link

@mysticatea
Copy link
Owner

I don't think that the promise.cancel method is the right direction.

Browsers use AbortController to abort asynchronous operations. This has been standardized already. ECMAScript is following that, cancellation API is discussing (yes, resumed it!) in https://github.com/tc39/proposal-cancellation. It will be similar to AbortController but not depend on DOM API.

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

No branches or pull requests

4 participants