andywer / threads.js

🧵 Make web workers & worker threads as simple as a function call.
https://threads.js.org/
MIT License
3.06k stars 163 forks source link

silence "Message from worker before finishing initialization" if the message is an init message #468

Open claycoleman opened 1 year ago

claycoleman commented 1 year ago

using DEBUG=threads:* to debug some threads stuff, and was confused for a second about seeing debug messages with "Message from worker before finishing initialization". Turns out the messages it was receiving before initialization were actually the init messages.

This led me into a small rabbit hole, where I thought I was somehow sending messages to the pool too soon, so I looked in the docs to figure out if there was a way to await pool initialization, but didn't find anything, etc.