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).
10 ## [2.6.2] - 2023-06-12
14 - Fix new worker use after creation in dynamic pool given the current worker choice strategy.
16 ## [2.6.1] - 2023-06-10
20 - Add worker choice strategy documentation: [README.md](./src/pools/selection-strategies/README.md).
24 - Fix average statistics computation: ensure failed tasks are not accounted.
26 ## [2.6.0] - 2023-06-09
30 - Add `LEAST_ELU` worker choice strategy (experimental).
31 - Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
35 - Refactor pool worker node usage internals.
36 - Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
37 - Breaking change: pool information `info` property object fields have been renamed.
41 - Fix wait time accounting.
42 - Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
43 - Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
45 ## [2.5.4] - 2023-06-07
49 - Add Event Loop Utilization (ELU) statistics to worker tasks usage.
53 - Compute statistics at the worker level only if needed.
54 - Add `worker-threads` options to thread pool options.
58 - Make the `LEAST_BUSY` strategy only relies on task runtime.
60 ## [2.5.3] - 2023-06-04
64 - Refine pool information content.
65 - Limit pool internals public exposure.
67 ## [2.5.2] - 2023-06-02
71 - Add `taskError` pool event for task execution error.
72 - Add pool information `info` property to pool.
73 - Emit pool information on `busy` and `full` pool events.
75 ## [2.5.1] - 2023-06-01
79 - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
80 - Add `error` pool event for uncaught worker error.
82 ## [2.5.0] - 2023-05-31
86 - Switch pool event emitter to `EventEmitterAsyncResource`.
87 - Add tasks wait time accounting in per worker tasks usage.
88 - Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
92 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
94 ## [2.4.14] - 2023-05-09
98 - Ensure no undefined task runtime can land in the tasks history.
99 - Fix median computation implementation once again.
103 - Unit tests for median and queue implementations.
105 ## [2.4.13] - 2023-05-08
109 - Fix worker choice strategy options validation.
110 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
112 ## [2.4.12] - 2023-05-06
116 - Support multiple task functions per worker.
117 - Add custom worker weights support to worker choice strategies options.
121 - Use O(1) queue implementation for tasks queueing.
125 - Fix median computation implementation.
126 - Fix fair share worker choice strategy internals update.
128 ## [2.4.11] - 2023-04-23
132 - Optimize free worker finding in worker choice strategies.
134 ## [2.4.10] - 2023-04-15
138 - Fix typescript type definition for worker function: ensure the input data is optional.
139 - Fix typescript type definition for pool execute(): ensure the input data is optional.
141 ## [2.4.9] - 2023-04-15
145 - Add tasks queue enablement runtime setter to pool.
146 - Add tasks queue options runtime setter to pool.
147 - Add worker choice strategy options runtime setter to pool.
151 - Remove the tasks queuing experimental status.
155 - Fix worker function type definition and validation.
156 - Fix worker choice strategy options handling.
158 ## [2.4.8] - 2023-04-12
162 - Fix message between main worker and worker type definition for tasks.
163 - Fix code documentation.
165 ## [2.4.7] - 2023-04-11
169 - Add worker tasks queue options to pool options.
173 - Fix missing documentation.
175 ## [2.4.6] - 2023-04-10
179 - Ensure one task at a time is executed per worker with tasks queueing enabled.
180 - Properly count worker executing tasks with tasks queueing enabled.
182 ## [2.4.5] - 2023-04-09
186 - Use monotonic high resolution timer for worker tasks runtime.
187 - Add worker tasks median runtime to statistics.
188 - Add worker tasks queue (experimental).
190 ## [2.4.4] - 2023-04-07
194 - Add `PoolEvents` enumeration and `PoolEvent` type.
198 - Destroy worker only on alive check.
200 ## [2.4.3] - 2023-04-07
204 - Fix typedoc generation with inheritance.
206 ## [2.4.2] - 2023-04-06
210 - Add `full` event to dynamic pool.
211 - Keep worker choice strategy in memory for conditional reuse.
215 - Fix possible negative worker key at worker removal in worker choice strategies.
217 ## [2.4.1] - 2023-04-05
221 - Optimize worker choice strategy for dynamic pool.
225 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
227 ## [2.4.0] - 2023-04-04
231 - Add `LESS_BUSY` worker choice strategy.
235 - Optimize worker storage in pool.
236 - Optimize worker alive status check.
237 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
238 - Optimize `LESS_USED` worker choice strategy.
239 - Update benchmarks versus external threads pools.
240 - Optimize tasks usage statistics requirements for worker choice strategy.
244 - Ensure trimmable characters are checked at pool initialization.
245 - Fix message id integer overflow.
246 - Fix pool worker removal in worker choice strategy internals.
247 - Fix package publication with pnpm.
249 ## [2.4.0-3] - 2023-04-04
253 - Add `LESS_BUSY` worker choice strategy.
257 - Optimize worker storage in pool.
258 - Optimize worker alive status check.
259 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
260 - Optimize `LESS_USED` worker choice strategy.
261 - Update benchmarks versus external threads pools.
265 - Ensure trimmable characters are checked at pool initialization.
266 - Fix message id integer overflow.
267 - Fix pool worker removal in worker choice strategy internals.
268 - Fix package publication with pnpm.
270 ## [2.4.0-2] - 2023-04-03
274 - Add `LESS_BUSY` worker choice strategy.
278 - Optimize worker storage in pool.
279 - Optimize worker alive status check.
280 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
281 - Optimize `LESS_USED` worker choice strategy.
285 - Ensure trimmable characters are checked at pool initialization.
286 - Fix message id integer overflow.
287 - Fix pool worker removal in worker choice strategy internals.
288 - Fix package publication with pnpm.
290 ## [2.4.0-1] - 2023-04-03
294 - Add `LESS_BUSY` worker choice strategy.
298 - Optimize worker storage in pool.
299 - Optimize worker alive status check.
300 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
301 - Optimize `LESS_USED` worker choice strategy.
305 - Ensure trimmable characters are checked at pool initialization.
306 - Fix message id integer overflow.
307 - Fix pool worker removal in worker choice strategy internals.
309 ## [2.4.0-0] - 2023-04-03
313 - Add `LESS_BUSY` worker choice strategy.
317 - Optimize worker storage in pool.
318 - Optimize worker alive status check.
319 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
320 - Optimize `LESS_USED` worker choice strategy.
324 - Ensure trimmable characters are checked at pool initialization.
325 - Fix message id integer overflow.
326 - Fix pool worker removal in worker choice strategy internals.
328 ## [2.3.10] - 2023-03-18
332 - Fix `exports` syntax for ESM and CommonJS.
336 - Permit SemVer pre-release publication.
338 ## [2.3.10-2] - 2023-03-18
342 - Fix `exports` syntax for ESM and CommonJS.
344 ## [2.3.10-1] - 2023-03-18
348 - Permit SemVer pre-release publication.
350 ## [2.3.10-0] - 2023-03-18
354 - Fix `exports` syntax for ESM and CommonJS.
356 ## [2.3.9] - 2023-03-18
360 - Introduce ESM module support along with CommonJS one.
364 - Fix brown paper bag bug referencing the same object literal.
366 ## [2.3.8] - 2023-03-18
370 - Switch internal benchmarking code to benny.
371 - Switch to TypeScript 5.x.x.
372 - Switch rollup bundler plugins to core ones.
373 - Switch to TSDoc syntax.
374 - Enforce conventional commits.
378 - Fix random integer generator.
379 - Fix worker choice strategy pool type identification at initialization.
381 ## [2.3.7] - 2022-10-23
385 - Switch to open collective FOSS project funding platform.
386 - Switch to ts-standard linter configuration on TypeScript code.
390 - Fixed missing async on pool execute method.
391 - Fixed typing in TypeScript example.
392 - Fixed types in unit tests.
394 ## [2.3.6] - 2022-10-22
398 - Cleanup pool attributes and methods.
399 - Refine error types thrown.
403 - Fix continuous integration build on windows.
404 - Fix code coverage reporting by using c8 instead of nyc.
406 ## [2.3.5] - 2022-10-21
410 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
411 - Optimize tasks usage lookup implementation.
415 - Fix missed pool event emitter type export.
416 - Fix typedoc documentation generation.
418 ## [2.3.4] - 2022-10-17
422 - Fully automate release process with release-it.
426 - Optimize fair share task scheduling algorithm implementation.
427 - Update benchmarks versus external pools results with latest version.
429 ## [2.3.3] - 2022-10-15
433 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
435 ## [2.3.2] - 2022-10-14
439 - Optimize fair share worker selection strategy implementation.
443 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
445 ## [2.3.1] - 2022-10-13
449 - Pool worker choice strategies:
450 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
451 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
453 ## [2.2.2] - 2022-10-09
457 - Fixed `README.md` file.
459 ## [2.2.1] - 2022-10-08
463 - Dynamic worker choice strategy change at runtime.
465 ## [2.2.0] - 2022-01-05
469 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
471 ## [2.1.0] - 2021-08-29
475 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
479 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
480 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
481 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
482 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
484 ## [2.0.2] - 2021-05-12
488 - Fix `busy` event emission on fixed pool type
490 ## [2.0.1] - 2021-03-16
494 - Check if pool options are properly set.
495 - `busy` event is emitted on all pool types.
497 ## [2.0.0] - 2021-03-01
501 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
505 - `FullPool` event is now renamed to `busy`.
506 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
507 _Find more details on our JSDoc._
509 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
511 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
513 ### Pool options types declaration merge
515 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
517 #### New `export` strategy
521 const DynamicThreadPool = require('poolifier/lib/dynamic')
523 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
526 But you should always prefer just using
529 const { DynamicThreadPool } = require('poolifier')
532 #### New type definitions for input data and response
534 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
535 _This is not a limitation by poolifier but NodeJS._
537 #### Public property replacements
539 `numWorkers` property is now `numberOfWorkers`
541 #### Internal (protected) properties and methods renaming
543 These properties are not intended for end users
545 - `id` => `nextMessageId`
547 These methods are not intended for end users
549 - `_chooseWorker` => `chooseWorker`
550 - `_newWorker` => `createWorker`
551 - `_execute` => `internalExecute`
552 - `_chooseWorker` => `chooseWorker`
553 - `_checkAlive` => `checkAlive`
555 - `_runAsync` => `runAsync`
557 ## [1.1.0] - 2020-05-21
561 - ThreadWorker support async functions as option
562 - Various external library patches
564 ## [1.0.0] - 2020-01-24
568 - FixedThreadPool implementation
569 - DynamicThreadPool implementation
570 - WorkerThread implementation to improve developer experience