threads.js
threads.js copied to clipboard
Better error message for Did not receive an init message from worker after 60000ms
Error: Timeout: Did not receive an init message from worker after 60000ms. Make sure the worker calls expose().
at Timeout._onTimeout (/Applications/TidGi.app/Contents/Resources/app.asar/.webpack/main/file:/Users/runner/work/TidGi-Desktop/TidGi-Desktop/node_modules/threads/dist/master/spawn.js:35:53)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
But its hard to tell which one causes the error (I have multiple workers)
And this only happen on electron startup sometimes, not always, maybe listener registered too late? Can I delay the expose so the listener gets the message always?
Good point. Might be a duplicate of #420, though.
This usually happened when a import xxx failed.
And import maybe good in dev env, but bad after electron packaged. So this will happened in electron production mode.
I found it by moving some of import to dynamic import, and it never say Did not receive an init message from worker after https://github.com/andywer/threads.js/issues/478