You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all thanks for the library and your contribution to open source. I had a question regarding the timeout option. I could not find any documentation on this topic, however if I have missed it please do point it out.
I'm using Node.js, version v20.17.0
I've called the spawn method with a timeout option set to 1000 milliseconds (or 1 second).
Inside the actual "work" method sleeper, the execution was paused for 30000 milliseconds (or 30 seconds).
I'd expect that the timeout should kick in here... the promise awaited in main.ts has taken longer than the timeout, so it seems like the promise should reject?
output:
START MAIN { now: 2024-09-30T23:07:50.151Z }
WORKER START { now: 2024-09-30T23:07:50.273Z }
WORKER END { now: 2024-09-30T23:08:20.275Z }
MAIN got result from WORKER { workerResult: 'value from worker' }
END MAIN { now: 2024-09-30T23:08:20.280Z }
Similarly (and related), if instead I call the worker and it exits (or dies) by swapping the commented out line in main.ts:
Hello there 👋🏽
First of all thanks for the library and your contribution to open source. I had a question regarding the
timeout
option. I could not find any documentation on this topic, however if I have missed it please do point it out.v20.17.0
spawn
method with atimeout
option set to1000
milliseconds (or 1 second).sleeper
, the execution was paused for30000
milliseconds (or 30 seconds).Here's the code:
main.ts
worker.ts
I'd expect that the timeout should kick in here... the promise awaited in
main.ts
has taken longer than the timeout, so it seems like the promise should reject?output:
Similarly (and related), if instead I call the worker and it exits (or dies) by swapping the commented out line in
main.ts
:The promise in
main.ts
never rejects or resolves, despite having set thetimeout
.So I'm wondering, how should I expect this timeout to behave? What effect does it have? Does this work?
The text was updated successfully, but these errors were encountered: