Skip to content

Commit 84583c6

Browse files
committed
fix: wait for WASM runtime to become ready at startup
1 parent 1b6f6e7 commit 84583c6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cmd/chromad/static/chroma.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ class ChromaWASM {
1212
try {
1313
// Create a new Go instance (wasm_exec.js already imported in initChroma)
1414
const go = new Go();
15-
WebAssembly.instantiateStreaming(fetch("./static/chroma.wasm"), go.importObject).then((result) => {
16-
go.run(result.instance);
17-
this.ready = true;
18-
});
15+
const result = await WebAssembly.instantiateStreaming(
16+
fetch("./static/chroma.wasm"),
17+
go.importObject
18+
);
19+
go.run(result.instance);
20+
this.ready = true;
1921
console.log("Chroma WASM module initialized successfully");
2022
} catch (error) {
2123
console.error("Failed to initialize Chroma WASM module:", error);

0 commit comments

Comments
 (0)