3 All notable changes to this project will be documented in this file.
5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
12 - Ensure no tasks are queued when trying to soft kill a dynamic worker.
14 ## [2.6.2] - 2023-06-12
18 - Fix new worker use after creation in dynamic pool given the current worker choice strategy.
20 ## [2.6.1] - 2023-06-10
24 - Add worker choice strategy documentation: [README.md](./src/pools/selection-strategies/README.md).
28 - Fix average statistics computation: ensure failed tasks are not accounted.
30 ## [2.6.0] - 2023-06-09
34 - Add `LEAST_ELU` worker choice strategy (experimental).
35 - Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
39 - Refactor pool worker node usage internals.
40 - Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
41 - Breaking change: pool information `info` property object fields have been renamed.
45 - Fix wait time accounting.
46 - Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
47 - Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
49 ## [2.5.4] - 2023-06-07
53 - Add Event Loop Utilization (ELU) statistics to worker tasks usage.
57 - Compute statistics at the worker level only if needed.
58 - Add `worker-threads` options to thread pool options.
62 - Make the `LEAST_BUSY` strategy only relies on task runtime.
64 ## [2.5.3] - 2023-06-04
68 - Refine pool information content.
69 - Limit pool internals public exposure.
71 ## [2.5.2] - 2023-06-02
75 - Add `taskError` pool event for task execution error.
76 - Add pool information `info` property to pool.
77 - Emit pool information on `busy` and `full` pool events.
79 ## [2.5.1] - 2023-06-01
83 - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
84 - Add `error` pool event for uncaught worker error.
86 ## [2.5.0] - 2023-05-31
90 - Switch pool event emitter to `EventEmitterAsyncResource`.
91 - Add tasks wait time accounting in per worker tasks usage.
92 - Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
96 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
98 ## [2.4.14] - 2023-05-09
102 - Ensure no undefined task runtime can land in the tasks history.
103 - Fix median computation implementation once again.
107 - Unit tests for median and queue implementations.
109 ## [2.4.13] - 2023-05-08
113 - Fix worker choice strategy options validation.
114 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
116 ## [2.4.12] - 2023-05-06
120 - Support multiple task functions per worker.
121 - Add custom worker weights support to worker choice strategies options.
125 - Use O(1) queue implementation for tasks queueing.
129 - Fix median computation implementation.
130 - Fix fair share worker choice strategy internals update.
132 ## [2.4.11] - 2023-04-23
136 - Optimize free worker finding in worker choice strategies.
138 ## [2.4.10] - 2023-04-15
142 - Fix typescript type definition for worker function: ensure the input data is optional.
143 - Fix typescript type definition for pool execute(): ensure the input data is optional.
145 ## [2.4.9] - 2023-04-15
149 - Add tasks queue enablement runtime setter to pool.
150 - Add tasks queue options runtime setter to pool.
151 - Add worker choice strategy options runtime setter to pool.
155 - Remove the tasks queuing experimental status.
159 - Fix worker function type definition and validation.
160 - Fix worker choice strategy options handling.
162 ## [2.4.8] - 2023-04-12
166 - Fix message between main worker and worker type definition for tasks.
167 - Fix code documentation.
169 ## [2.4.7] - 2023-04-11
173 - Add worker tasks queue options to pool options.
177 - Fix missing documentation.
179 ## [2.4.6] - 2023-04-10
183 - Ensure one task at a time is executed per worker with tasks queueing enabled.
184 - Properly count worker executing tasks with tasks queueing enabled.
186 ## [2.4.5] - 2023-04-09
190 - Use monotonic high resolution timer for worker tasks runtime.
191 - Add worker tasks median runtime to statistics.
192 - Add worker tasks queue (experimental).
194 ## [2.4.4] - 2023-04-07
198 - Add `PoolEvents` enumeration and `PoolEvent` type.
202 - Destroy worker only on alive check.
204 ## [2.4.3] - 2023-04-07
208 - Fix typedoc generation with inheritance.
210 ## [2.4.2] - 2023-04-06
214 - Add `full` event to dynamic pool.
215 - Keep worker choice strategy in memory for conditional reuse.
219 - Fix possible negative worker key at worker removal in worker choice strategies.
221 ## [2.4.1] - 2023-04-05
225 - Optimize worker choice strategy for dynamic pool.
229 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
231 ## [2.4.0] - 2023-04-04
235 - Add `LESS_BUSY` worker choice strategy.
239 - Optimize worker storage in pool.
240 - Optimize worker alive status check.
241 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
242 - Optimize `LESS_USED` worker choice strategy.
243 - Update benchmarks versus external threads pools.
244 - Optimize tasks usage statistics requirements for worker choice strategy.
248 - Ensure trimmable characters are checked at pool initialization.
249 - Fix message id integer overflow.
250 - Fix pool worker removal in worker choice strategy internals.
251 - Fix package publication with pnpm.
253 ## [2.4.0-3] - 2023-04-04
257 - Add `LESS_BUSY` worker choice strategy.
261 - Optimize worker storage in pool.
262 - Optimize worker alive status check.
263 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
264 - Optimize `LESS_USED` worker choice strategy.
265 - Update benchmarks versus external threads pools.
269 - Ensure trimmable characters are checked at pool initialization.
270 - Fix message id integer overflow.
271 - Fix pool worker removal in worker choice strategy internals.
272 - Fix package publication with pnpm.
274 ## [2.4.0-2] - 2023-04-03
278 - Add `LESS_BUSY` worker choice strategy.
282 - Optimize worker storage in pool.
283 - Optimize worker alive status check.
284 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
285 - Optimize `LESS_USED` worker choice strategy.
289 - Ensure trimmable characters are checked at pool initialization.
290 - Fix message id integer overflow.
291 - Fix pool worker removal in worker choice strategy internals.
292 - Fix package publication with pnpm.
294 ## [2.4.0-1] - 2023-04-03
298 - Add `LESS_BUSY` worker choice strategy.
302 - Optimize worker storage in pool.
303 - Optimize worker alive status check.
304 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
305 - Optimize `LESS_USED` worker choice strategy.
309 - Ensure trimmable characters are checked at pool initialization.
310 - Fix message id integer overflow.
311 - Fix pool worker removal in worker choice strategy internals.
313 ## [2.4.0-0] - 2023-04-03
317 - Add `LESS_BUSY` worker choice strategy.
321 - Optimize worker storage in pool.
322 - Optimize worker alive status check.
323 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
324 - Optimize `LESS_USED` worker choice strategy.
328 - Ensure trimmable characters are checked at pool initialization.
329 - Fix message id integer overflow.
330 - Fix pool worker removal in worker choice strategy internals.
332 ## [2.3.10] - 2023-03-18
336 - Fix `exports` syntax for ESM and CommonJS.
340 - Permit SemVer pre-release publication.
342 ## [2.3.10-2] - 2023-03-18
346 - Fix `exports` syntax for ESM and CommonJS.
348 ## [2.3.10-1] - 2023-03-18
352 - Permit SemVer pre-release publication.
354 ## [2.3.10-0] - 2023-03-18
358 - Fix `exports` syntax for ESM and CommonJS.
360 ## [2.3.9] - 2023-03-18
364 - Introduce ESM module support along with CommonJS one.
368 - Fix brown paper bag bug referencing the same object literal.
370 ## [2.3.8] - 2023-03-18
374 - Switch internal benchmarking code to benny.
375 - Switch to TypeScript 5.x.x.
376 - Switch rollup bundler plugins to core ones.
377 - Switch to TSDoc syntax.
378 - Enforce conventional commits.
382 - Fix random integer generator.
383 - Fix worker choice strategy pool type identification at initialization.
385 ## [2.3.7] - 2022-10-23
389 - Switch to open collective FOSS project funding platform.
390 - Switch to ts-standard linter configuration on TypeScript code.
394 - Fixed missing async on pool execute method.
395 - Fixed typing in TypeScript example.
396 - Fixed types in unit tests.
398 ## [2.3.6] - 2022-10-22
402 - Cleanup pool attributes and methods.
403 - Refine error types thrown.
407 - Fix continuous integration build on windows.
408 - Fix code coverage reporting by using c8 instead of nyc.
410 ## [2.3.5] - 2022-10-21
414 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
415 - Optimize tasks usage lookup implementation.
419 - Fix missed pool event emitter type export.
420 - Fix typedoc documentation generation.
422 ## [2.3.4] - 2022-10-17
426 - Fully automate release process with release-it.
430 - Optimize fair share task scheduling algorithm implementation.
431 - Update benchmarks versus external pools results with latest version.
433 ## [2.3.3] - 2022-10-15
437 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
439 ## [2.3.2] - 2022-10-14
443 - Optimize fair share worker selection strategy implementation.
447 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
449 ## [2.3.1] - 2022-10-13
453 - Pool worker choice strategies:
454 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
455 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
457 ## [2.2.2] - 2022-10-09
461 - Fixed `README.md` file.
463 ## [2.2.1] - 2022-10-08
467 - Dynamic worker choice strategy change at runtime.
469 ## [2.2.0] - 2022-01-05
473 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
475 ## [2.1.0] - 2021-08-29
479 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
483 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
484 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
485 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
486 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
488 ## [2.0.2] - 2021-05-12
492 - Fix `busy` event emission on fixed pool type
494 ## [2.0.1] - 2021-03-16
498 - Check if pool options are properly set.
499 - `busy` event is emitted on all pool types.
501 ## [2.0.0] - 2021-03-01
505 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
509 - `FullPool` event is now renamed to `busy`.
510 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
511 _Find more details on our JSDoc._
513 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
515 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
517 ### Pool options types declaration merge
519 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
521 #### New `export` strategy
525 const DynamicThreadPool = require('poolifier/lib/dynamic')
527 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
530 But you should always prefer just using
533 const { DynamicThreadPool } = require('poolifier')
536 #### New type definitions for input data and response
538 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
539 _This is not a limitation by poolifier but NodeJS._
541 #### Public property replacements
543 `numWorkers` property is now `numberOfWorkers`
545 #### Internal (protected) properties and methods renaming
547 These properties are not intended for end users
549 - `id` => `nextMessageId`
551 These methods are not intended for end users
553 - `_chooseWorker` => `chooseWorker`
554 - `_newWorker` => `createWorker`
555 - `_execute` => `internalExecute`
556 - `_chooseWorker` => `chooseWorker`
557 - `_checkAlive` => `checkAlive`
559 - `_runAsync` => `runAsync`
561 ## [1.1.0] - 2020-05-21
565 - ThreadWorker support async functions as option
566 - Various external library patches
568 ## [1.0.0] - 2020-01-24
572 - FixedThreadPool implementation
573 - DynamicThreadPool implementation
574 - WorkerThread implementation to improve developer experience