From 19bf699657beff29cc6954d99f7810536d1e5705 Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Wed, 1 May 2024 21:48:35 -0600 Subject: [PATCH] Compile and instantiate wasm modules on a background thread (cherry-pick #11270) (#11287) Cherry-picked Compile and instantiate wasm modules on a background thread (#11270) Release Notes: - Fixed a hang that could occur when loading some extensions, by loading extensions on a background thread. Co-authored-by: Max Brunsfeld --- crates/extension/src/wasm_host.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/extension/src/wasm_host.rs b/crates/extension/src/wasm_host.rs index 51b306f1ff3c3b13752f44bdd550670e65581970..c0e9ec753a98c9979fb76fab3cc1d6ea8cfe0d9b 100644 --- a/crates/extension/src/wasm_host.rs +++ b/crates/extension/src/wasm_host.rs @@ -106,9 +106,9 @@ impl WasmHost { wasm_bytes: Vec, manifest: Arc, executor: BackgroundExecutor, - ) -> impl 'static + Future> { + ) -> Task> { let this = self.clone(); - async move { + executor.clone().spawn(async move { let zed_api_version = parse_wasm_extension_version(&manifest.id, &wasm_bytes)?; let component = Component::from_binary(&this.engine, &wasm_bytes) @@ -147,7 +147,7 @@ impl WasmHost { tx, zed_api_version, }) - } + }) } async fn build_wasi_ctx(&self, manifest: &Arc) -> Result {