-
Notifications
You must be signed in to change notification settings - Fork 13
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
Use cases for AbortSignal.any() #25
Comments
For Cloudflare Workers, the key usecase that I can imagine supporting is the Timeout case, described in the explainer: const signalWithTimeout = AbortSignal.any([signal, AbortSignal.timeout(10_000)]);
const response = await fetch(tile.url, {signal: signalWithTimeout}); With this example, I like the layering of this in that it does not modify One thing that I've asked about before (and would still like to have) is the ability to cancel an const signal = AbortSignal.timeout(10_000);
// The signal will trigger after 10 seconds.
signal.cancel(); // or signal.close()
// The signal is canceled and will never trigger. All abort event handlers can be released. This is a separate discussion, however. The two would pair nicely with one another tho. Cloudflare currently has no plans for implementing |
Another relevant thread here: whatwg/dom#1082 |
There's no further action to be done here. |
Cancelling an AbortSignal sounds interesting. We should then also add a way to re-engage it later. We could use this to enforce timeouts for tasks on low-priority queues only when there are tasks in a higher-priority queue. |
One of the active discussions at the whatwg/dom repo is creation of an AbortSignal that can follow other AbortSignals... see whatwg/dom#920
There is a proposal on the table for
AbortSignal.any()
here: https://github.com/shaseley/abort-signal-any/blob/main/README.mdThe key question for this group is whether the proposal looks good and whether wintercg has any feedback for the discussion.
The text was updated successfully, but these errors were encountered: