Stream: jco

Topic: Are the WASI shims in jco thread blocking?


view this post on Zulip Landon James (Jan 22 2024 at 22:45):

I have some components that use the wasi:http shim to make network calls. I initially assumed these would be totally blocking, but when looking through the @bytecodealliance/preview2-shim code I noticed the lib/io/worker-* files that seem to imply some of the wasi:* backed IO is happening in a Worker and is not blocking.

Curious if this is all piped in with jco's functionality by default or if I would need to do some special configuration to use the worker-* versions of the shims? I've been exploring instantiating/calling my components in a Worker thread to avoid blocking, but if it is already non-blocking that would be great!

view this post on Zulip Guy Bedford (Jan 22 2024 at 22:54):

@Landon James yes we have a "non-blocking" polls implementation but this is only currently supported in Node.js. Supporting the browser is the next priority now that this implementation has been completed, but that work will be a little while still.

view this post on Zulip Landon James (Jan 22 2024 at 23:05):

Ahh great to hear, I am only looking to support Node at the moment. Do I need to do anything to enable that? I see that the nodejs/http.js implementation is only pulling in the worker-io stuff at the moment, so not sure if that is fully non-blocking yet? Happy to contribute some work here once I figure out what needs to be done since this would be more helpful than wrapping all my own stuff in Workers.

view this post on Zulip Guy Bedford (Jan 22 2024 at 23:30):

oh, yeah it should all work out in Node.js if you use the default transpile options - http is fully supported


Last updated: Nov 22 2024 at 17:03 UTC