-
Notifications
You must be signed in to change notification settings - Fork 74
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
Comments
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 inwasmer_wasix::http::web_http_client
to use a RAII guard which triggers an abort controller onDrop
and pass that abort controller'sAbortSignal
through to the request (theRequestInit
type has asignal
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
'sfrom_registry()
andfrom_file()
constructors to accept an optionalAbortSignal
parameter and usefutures::select!()
to wait on either the package loading or an abort, whichever resolves first. If thefutures::select!()
detects an abort, it should automatically drop the future fromBinaryPackage::from_registry()
orBinaryPackage::from_webc()
, which will automatically cancel any child futures until eventually the HTTP request is cancelled.SDK-61
The text was updated successfully, but these errors were encountered: