fix: correctly load nodes from cache/fetch
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 4m9s
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 4m9s
This commit is contained in:
@@ -56,16 +56,17 @@ export class RemoteNodeRegistry implements NodeRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async fetchNodeWasm(nodeId: `${string}/${string}/${string}`) {
|
private async fetchNodeWasm(nodeId: `${string}/${string}/${string}`) {
|
||||||
const res = await Promise.race([
|
const cachedNode = this.cache?.get(nodeId);
|
||||||
this.fetchArrayBuffer(`nodes/${nodeId}.wasm`),
|
if(cachedNode){
|
||||||
this.cache?.get(nodeId),
|
return cachedNode;
|
||||||
]);
|
|
||||||
|
|
||||||
if (!res) {
|
|
||||||
throw new Error(`Failed to load node wasm ${nodeId}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
const node = this.fetchArrayBuffer(`nodes/${nodeId}.wasm`);
|
||||||
|
if (node) {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(`Failed to load node wasm ${nodeId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async load(nodeIds: `${string}/${string}/${string}`[]) {
|
async load(nodeIds: `${string}/${string}/${string}`[]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user