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

[SDK-61] Allow users to abort loading a package #382

Open
Michael-F-Bryan opened this issue Dec 21, 2023 · 0 comments
Open

[SDK-61] Allow users to abort loading a package #382

Michael-F-Bryan opened this issue Dec 21, 2023 · 0 comments
Assignees

Comments

@Michael-F-Bryan
Copy link
Contributor

Michael-F-Bryan commented Dec 21, 2023

In #378, it'd be nice of we can abort the loading of a package if the arguments to useWasmerPackage() change.

To do this, we need to update things in two places.

First, we need to update the fetch() function in wasmer_wasix::http::web_http_client to use a RAII guard which triggers an abort controller on Drop and pass that abort controller's AbortSignal through to the request (the RequestInit type has a signal setter). That'll make sure any in-progress HTTP requests get cancelled automatically when the future is dropped.

We also need to update wasmer_js::Wasmer's from_registry() and from_file() constructors to accept an optional AbortSignal parameter and use futures::select!() to wait on either the package loading or an abort, whichever resolves first. If the futures::select!() detects an abort, it should automatically drop the future from BinaryPackage::from_registry() or BinaryPackage::from_webc(), which will automatically cancel any child futures until eventually the HTTP request is cancelled.

SDK-61

@Michael-F-Bryan Michael-F-Bryan self-assigned this Dec 21, 2023
@Michael-F-Bryan Michael-F-Bryan changed the title Allow users to abort loading a package [SDK-61] Allow users to abort loading a package Dec 21, 2023
@wasmerio wasmerio deleted a comment from linear bot Dec 21, 2023
@Michael-F-Bryan Michael-F-Bryan closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2023
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

1 participant