Closed Michsior14 closed 1 year ago
Thanks, I'll review your PR tomorrow. I see there are no tests added. Would it be possible to unit test the new cleanup functionality?
Thanks, I'll review your PR tomorrow. I see there are no tests added. Would it be possible to unit test the new cleanup functionality?
As in the PR description I wanted to first confirm this is the way to go ;)
ah sorry, makes sense 😅
This looks really good @Michsior14, exactly what we need 👌 . If you can add tests I think all is ready to merge this PR.
@josdejong I've added working tests using MessageChannel
since I had no other idea how to tackle this.
Thanks! It is indeed not so trivial to test whether onTerminateWorker
since it is shutting down the worker. Sounds like a good solution to use MessageChannel
! I'll now merge your PR and publish a new version of workerpool
at npm.
Published now in v6.4.0
, thanks again!
Adds termination handler in a worker context to allow releasing resources.
Tests will be added after feedback (to confirm interfaces/idea).
Resolves #353