node-worker-threads-pool
node-worker-threads-pool copied to clipboard
clear timers
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.
@SUCHMOKUO may I kindly ask for some opinions and/or a review on this? Thanks in advance :-)