mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-26 00:19:46 +00:00
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.
This commit is contained in:
parent
fb0d2e948f
commit
a194c0aa6e
1 changed files with 3 additions and 3 deletions
|
@ -106,9 +106,9 @@ impl WasmHost {
|
||||||
wasm_bytes: Vec<u8>,
|
wasm_bytes: Vec<u8>,
|
||||||
manifest: Arc<ExtensionManifest>,
|
manifest: Arc<ExtensionManifest>,
|
||||||
executor: BackgroundExecutor,
|
executor: BackgroundExecutor,
|
||||||
) -> impl 'static + Future<Output = Result<WasmExtension>> {
|
) -> Task<Result<WasmExtension>> {
|
||||||
let this = self.clone();
|
let this = self.clone();
|
||||||
async move {
|
executor.clone().spawn(async move {
|
||||||
let zed_api_version = parse_wasm_extension_version(&manifest.id, &wasm_bytes)?;
|
let zed_api_version = parse_wasm_extension_version(&manifest.id, &wasm_bytes)?;
|
||||||
|
|
||||||
let component = Component::from_binary(&this.engine, &wasm_bytes)
|
let component = Component::from_binary(&this.engine, &wasm_bytes)
|
||||||
|
@ -147,7 +147,7 @@ impl WasmHost {
|
||||||
tx,
|
tx,
|
||||||
zed_api_version,
|
zed_api_version,
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn build_wasi_ctx(&self, manifest: &Arc<ExtensionManifest>) -> Result<wasi::WasiCtx> {
|
async fn build_wasi_ctx(&self, manifest: &Arc<ExtensionManifest>) -> Result<wasi::WasiCtx> {
|
||||||
|
|
Loading…
Reference in a new issue