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

Enable socket to be closed #39

Merged
merged 2 commits into from
Nov 20, 2023
Merged

Conversation

andreterron
Copy link
Contributor

This creates the DenoWorker.closeSocket() function, that closes the WebSocket, which can keep the process running, even when it's done executing.

Motivation

At val.town, users can sometimes write scripts that have promises that aren't awaited. We want to let those promises finish, ideally letting Deno exit whenever it thinks it's done.

Problem

Unresolved promises can cause the DenoWorker to never exit when the websocket is open. Example script:

// unresolved.js
new Promise(() => {})

When running the script above with deno run unresolved.js, it will exit naturally. When using DenoWorker, it will keep the process alive.

Solution

Closing the socket lets Deno properly exit like expected.

@KallynGowdy KallynGowdy merged commit 3d90ca4 into casual-simulation:master Nov 20, 2023
6 checks passed
@stevekrouse
Copy link

Thanks for merging @KallynGowdy!!

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.

3 participants