node-worker-threads-pool icon indicating copy to clipboard operation
node-worker-threads-pool copied to clipboard

clear timers

Open F7502 opened this issue 2 years ago • 1 comments

When running unit tests that involve worker pools I noticed this warning from jest:

Jest did not exit one second after the test run has completed.

This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.

Further investigation showed that the timeouts created by node-worker-threads-pool are still active and blocking jest from stopping.

This PR is a proposal to fix this. Whenever a task is done (successful or not) then the timeout is cleared. I am not sure how to test this properly though. Locally I was able to get rid of the jest warnings using my modifications.

F7502 avatar May 04 '22 07:05 F7502

@SUCHMOKUO may I kindly ask for some opinions and/or a review on this? Thanks in advance :-)

F7502 avatar May 05 '22 08:05 F7502