Skip to content
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

[ts-sdk] Ensure compositor instance cleanup (Node.js and browser) #907

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

wkozyra95
Copy link
Member

@wkozyra95 wkozyra95 commented Jan 7, 2025

  • Add LiveCompositor.terminate()
  • Fix issues in rendering that caused LiveCompositor not to be garbage collected. (stored in global react state)
  • Improve API of WASM package to make it simpler, plus add helpful component that wraps canvas

@wkozyra95 wkozyra95 changed the title [ts-sdk] Ensure compositor instance cleanup (Node.js and brrowserr) [ts-sdk] Ensure compositor instance cleanup (Node.js and browser) Jan 7, 2025
@wkozyra95 wkozyra95 force-pushed the @wkozyra95/ts-sdk-ensure-cleanup branch from 584ea57 to 7734ed6 Compare January 7, 2025 16:43
@wkozyra95 wkozyra95 force-pushed the @wkozyra95/ts-sdk-ensure-cleanup branch from 7734ed6 to 8961617 Compare January 7, 2025 16:48
@@ -5,7 +5,7 @@ import init, * as wasm from './generated/compositor_web';
* @param wasmModuleUrl {string} - An URL for `live-compositor.wasm` file. The file is located in `dist` folder.
*/
export async function loadWasmModule(wasmModuleUrl: string) {
await init(wasmModuleUrl);
await init({ module_or_path: wasmModuleUrl });
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

passing string works, but it triggers warning

public async close(): Promise<void> {
this.throttledUpdate.setFn(async () => {});
this.renderer.stop();
await this.throttledUpdate.waitForPendingCalls();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the throttledUpdate to class because I need to be able to wait for pending requests to finish, otherwise LiveCompositor.terminate() might kill the server before pending request are done

@wkozyra95 wkozyra95 marked this pull request as ready for review January 7, 2025 16:49
@wkozyra95 wkozyra95 requested review from noituri and BrtqKr January 7, 2025 16:49
Copy link
Member

@noituri noituri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wkozyra95 wkozyra95 merged commit 2853a93 into master Jan 8, 2025
5 checks passed
@wkozyra95 wkozyra95 deleted the @wkozyra95/ts-sdk-ensure-cleanup branch January 8, 2025 12:24
@wkozyra95 wkozyra95 self-assigned this Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants