https://github.com/josdejong/workerpool
- Feat: implement support for abort handlers in the workers (#448). Thanks @joshLong145.
- Feat: implement
Promise.finally()
on the custom promise class (#388). Thanks @joshLong145 and @wmertens. - Fix #460:
vite
example not working (#461). Thanks @datashaman.
- Fix transferring from the worker (#455). Thanks @LeonidPolukhin.
- Fix: #446 ensure the library can be used with older browsers.
- Fix: events not emitted when using (#439). Thanks @t0oF-azpn.
- Support capturing the stdout/stderr streams from the workers (#425, #423). Thanks @cpendery.
- Improve the logic to detect the Node.js platform (#421). Thanks @tamuratak.
- Improve types: unwrap Promise types (#419). Thanks @joshkel.
- Export the
Proxy
type (see #417). Thanks @tamuratak. - Use workerpool's
Promise
type definition (see #417). Thanks @tamuratak.
- Export the types
Pool
,WorkerPoolOptions
, andWorkerRegisterOptions
, see #416. Thanks @joshkel.
BREAKING CHANGE: the library now comes with TypeScript type definitions
included. There may be minor differences between the new, embedded type
definitions and the implementation from @types/workerpool
that was needed
before. For example, type WorkerPool
is called type Pool
now.
- Generate TypeScript types from JSDoc comments. Thanks @tamuratak.
BREAKING CHANGE: the library now throws an Error when passing unknown or
inherited properties for workerOpts
, workerThreadOpts
and forkOpts
.
- Fix: throw an error in case of unknown properties or inherited properties
in
workerOpts
,workerThreadOpts
andforkOpts
to protect against security issues related to prototype pollution (see ea5368c5e53d97120b952ffad151a318c1ff073c). - Fix: #56 document the return type of all functions.
- Docs: added a full usage example with Vite and Webpack5 (#408), thanks @KonghaYao.
BREAKING CHANGE: The setup to bundle workerpool
has been replaced. This should
be a drop-in replacement, but it may have impact depending on your setup.
- Switched build setup from Webpack to Rollup, see #403. Thanks @KonghaYao.
- Fix:
workerThreadOpts
not working whenworkerType: auto
, see #357.
- Implement support for passing options to web workers constructors (#400, #322). Thanks @DonatJR.
- Fix: a bug in the timeout of termination (#395, #387). Thanks @Michsior14.
- Fix: worker termination before it's ready (#394, #387). Thanks @Michsior14.
- Support transferable objects (#3, #374). Thanks @Michsior14.
- Implement a new callback
onTerminate
at the worker side, which can be used to clean up resources, and an optionworkerTerminateTimeout
which forcefully terminates a worker if it doesn't finish in time (#353, #377). Thanks @Michsior14. - Pass
workerThreadOpts
to theonTerminateWorker
callback (#376). Thanks @Michsior14.
- Fix #318: debug ports not being released when terminating a pool.
- Implement option
workerThreadOpts
to pass options to a worker of typethread
, aworker_thread
(#357, fixes #356). Thanks @galElmalah.
- Fix #343:
.terminate()
sometimes throwing an exception.
- Implement callbacks
onCreateWorker
andonTerminateWorker
. Thanks @forty. - Fix #326: robustness fix when terminating a workerpool.
- Fix v6.1.4 not being marked as latest anymore on npm due to bug fix release v2.3.4.
- Fix terminating a pool throwing an error when used in the browser.
Regression introduced in
v6.1.3
.
- Fix #147: disregard messages from terminated workers. Thanks @hhprogram and @Madgvox.
- Fix #253, add
./src
again in the published npm package, reverting the change inv6.1.1
(see also #243).
- Remove redundant
./src
folder from the published npm package, see #243. Thanks @Nytelife26.
- Implemented support for sending events from the worker to the main thread, see #51, #227. Thanks @Akryum.
- Fix an issue in Node.js nightly, see #230. Thanks @aduh95.
- Fix #232
workerpool
not working on IE 10.
- Make evaluation of offloaded functions a bit more secure by using
new Function
instead ofeval
. Thanks @tjenkinson.
- Fixes and more robustness in terminating workers. Thanks @boneskull.
- Fix #32, #175: the promise returned by
Pool.terminate()
now waits until subprocesses are dead before resolving. Thanks @boneskull.
- Removed examples from the npm package. Thanks @madbence.
BREAKING CHANGE: the library entry points are changed and new source maps are added. This may have impact on your project depending on your setup.
- Created separate library entry points in package.json for node.js and browser. Thanks @boneskull.
- Generated source maps for both minified and non-minified bundles.
- Removed deprecation warnings for
options.nodeWorker
(renamed tooptions.workerType
) andpool.clear()
(renamed topool.terminate()
).
- Fixed #121:
isMainThread
not working when usingworker_threads
. - Drop official support for node.js 8 (end of life).
- Fixed library not working in the browser. See #106.
- Fixed environment detection in browser. See #106. Thanks @acgrid.
- Fixed #96: WorkerPool not cancelling any pending tasks on termination.
- Deprecated option
nodeWorker
and created a new, more extensive optionworkerType
giving full control over the selected type of worker. Added new option'web'
to enforce use a Web Worker. See #85, #74. - In a node.js environment, the default
workerType
is changed from'process'
to'thread'
. See #85, #50. - Improved detection of environment (
browser
ornode
), fixing wrong detection in a Jest test environment. See #85.
- Pass argument
--max-old-space-size
to child processes. Thanks @patte. - Removed redundant dependencies, upgraded all devDependencies.
- Fixed Webpack issues of missing modules
child_process
andworker_threads
. See #43. - Bundled library changed due to the upgrade to Webpack 4. This could possibly lead to breaking changes.
- Implemented new option
maxQueueSize
. Thanks @colomboe. - Fixed exiting workers when the parent process is killed. Thanks @RogerKang.
- Fixed #81: Option
minWorkers: 'max'
not using the configuredmaxWorkers
. - Fixed not passing
nodeWorker
to workers initialized when creating a pool. Thanks @spacelan. - Internal restructure of the code: moved from
lib
tosrc
.
-
Improved error message when a node.js worker unexpectedly exits (see #58). Thanks @stefanpenner.
-
Allocate debug ports safely, this fixes an issue cause workers to exit unexpectedly if more then one worker pool is active, and the process is started with a debugger (
node debug
ornode --inspect
). Thanks @stefanpenner.
- Fix option
nodeWorker: 'auto'
not using worker threads when available. Thanks @stefanpenner.
- Implemented support for using
worker_threads
in Node.js, via the new optionnodeWorker: 'thread'
. Thanks @stefanpenner.
- Enable usage in ES6 Webpack projects.
- Dropped support for AMD module system.
- Backport fix for Node.js 16, see #309. Thanks @mansona.
- Fixed space in license field in
package.json
. Thanks @sagotsky.
- Add licence field to
package.json
. Thanks @greyd.
- Fixed bug where tasks that are cancelled in a Pool's queue causes following tasks to not run. Thanks @greemo.
- New method
Pool.terminate(force, timeout)
which will replacePool.clear(force)
. Thanks @jimsugg. - Fixed issue with never terminating zombie child processes. Thanks @jimsugg.
- Fixed a debug issue: look for
--inspect
within argument strings, instead of exact match. Thanks @jimsugg.
- Updated all examples to neatly include
.catch(...)
callbacks.
- Fixed #25: timer of a timeout starting when the task is created instead of when the task is started. Thanks @eclipsesk for input.
- Fixed #2 and #19: support for debugging child processes. Thanks @tptee.
- Implemented #18: method
pool.stats()
.
- Implemented support for registering the workers methods asynchronously. This enables asynchronous initialization of workers, for example when using AMD modules. Thanks @natlibfi-arlehiko.
- Implemented environment variables
platform
,isMainThread
, andcpus
. Thanks @natlibfi-arlehiko. - Implemented option
minWorkers
. Thanks @sergei202.
- Replaced conversion of Error-objecting using serializerr to custom implementation to prevent issues with serializing/deserializing functions. This conversion implementation loses the prototype object which means that e.g. 'TypeError' will become just 'Error' in the main code. See #8. Thanks @natlibfi-arlehiko.
- Fix for a bug in PhantomJS (see #7). Thanks @natlibfi-arlehiko.
- Determine
maxWorkers
as the number of CPU's minus one in browsers too. See #6.
- Fixed #5 error when loading via AMD or bundling using Webpack.
- Implemented serializing errors with stacktrace. Thanks @mujx.
- Added an error message when wrongly calling
pool.proxy
. - Fixed function
worker.pool
not accepting both a script and options. See #1. Thanks @freund17.
- Merged function
Pool.run
intoPool.exec
, simplifying the API.
- Implemented support for cancelling running tasks.
- Implemented support for cancelling running tasks after a timeout.
- Implemented support for both node.js and the browser.
- Implemented offloading functions.
- Implemented worker proxy.
- Added docs and examples.
- Module name registered at npm.