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 - Cluster pools tasks execution are not working: https://github.com/poolifier/poolifier/issues/782
16 - Ensure cluster pool destroy() gracefully shutdowns worker's server.
17 - Ensure pool event is emitted before task error promise rejection.
18 - Fix queued tasks count computation.
22 - Remove unneeded worker-threads worker `MessageChannel` internal usage for IPC.
24 ## [2.6.3] - 2023-06-19
28 - Ensure no tasks are queued when trying to soft kill a dynamic worker.
29 - Update strategies internals after statistics computation.
33 - Optimize O(1) queue implementation.
35 ## [2.6.2] - 2023-06-12
39 - Fix new worker use after creation in dynamic pool given the current worker choice strategy.
41 ## [2.6.1] - 2023-06-10
45 - Add worker choice strategy documentation: [README.md](./src/pools/selection-strategies/README.md).
49 - Fix average statistics computation: ensure failed tasks are not accounted.
51 ## [2.6.0] - 2023-06-09
55 - Add `LEAST_ELU` worker choice strategy (experimental).
56 - Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
60 - Refactor pool worker node usage internals.
61 - Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
62 - Breaking change: pool information `info` property object fields have been renamed.
66 - Fix wait time accounting.
67 - Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
68 - Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
70 ## [2.5.4] - 2023-06-07
74 - Add Event Loop Utilization (ELU) statistics to worker tasks usage.
78 - Compute statistics at the worker level only if needed.
79 - Add `worker-threads` options to thread pool options.
83 - Make the `LEAST_BUSY` strategy only relies on task runtime.
85 ## [2.5.3] - 2023-06-04
89 - Refine pool information content.
90 - Limit pool internals public exposure.
92 ## [2.5.2] - 2023-06-02
96 - Add `taskError` pool event for task execution error.
97 - Add pool information `info` property to pool.
98 - Emit pool information on `busy` and `full` pool events.
100 ## [2.5.1] - 2023-06-01
104 - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
105 - Add `error` pool event for uncaught worker error.
107 ## [2.5.0] - 2023-05-31
111 - Switch pool event emitter to `EventEmitterAsyncResource`.
112 - Add tasks wait time accounting in per worker tasks usage.
113 - Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
117 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
119 ## [2.4.14] - 2023-05-09
123 - Ensure no undefined task runtime can land in the tasks history.
124 - Fix median computation implementation once again.
128 - Unit tests for median and queue implementations.
130 ## [2.4.13] - 2023-05-08
134 - Fix worker choice strategy options validation.
135 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
137 ## [2.4.12] - 2023-05-06
141 - Support multiple task functions per worker.
142 - Add custom worker weights support to worker choice strategies options.
146 - Use O(1) queue implementation for tasks queueing.
150 - Fix median computation implementation.
151 - Fix fair share worker choice strategy internals update.
153 ## [2.4.11] - 2023-04-23
157 - Optimize free worker finding in worker choice strategies.
159 ## [2.4.10] - 2023-04-15
163 - Fix typescript type definition for worker function: ensure the input data is optional.
164 - Fix typescript type definition for pool execute(): ensure the input data is optional.
166 ## [2.4.9] - 2023-04-15
170 - Add tasks queue enablement runtime setter to pool.
171 - Add tasks queue options runtime setter to pool.
172 - Add worker choice strategy options runtime setter to pool.
176 - Remove the tasks queuing experimental status.
180 - Fix worker function type definition and validation.
181 - Fix worker choice strategy options handling.
183 ## [2.4.8] - 2023-04-12
187 - Fix message between main worker and worker type definition for tasks.
188 - Fix code documentation.
190 ## [2.4.7] - 2023-04-11
194 - Add worker tasks queue options to pool options.
198 - Fix missing documentation.
200 ## [2.4.6] - 2023-04-10
204 - Ensure one task at a time is executed per worker with tasks queueing enabled.
205 - Properly count worker executing tasks with tasks queueing enabled.
207 ## [2.4.5] - 2023-04-09
211 - Use monotonic high resolution timer for worker tasks runtime.
212 - Add worker tasks median runtime to statistics.
213 - Add worker tasks queue (experimental).
215 ## [2.4.4] - 2023-04-07
219 - Add `PoolEvents` enumeration and `PoolEvent` type.
223 - Destroy worker only on alive check.
225 ## [2.4.3] - 2023-04-07
229 - Fix typedoc generation with inheritance.
231 ## [2.4.2] - 2023-04-06
235 - Add `full` event to dynamic pool.
236 - Keep worker choice strategy in memory for conditional reuse.
240 - Fix possible negative worker key at worker removal in worker choice strategies.
242 ## [2.4.1] - 2023-04-05
246 - Optimize worker choice strategy for dynamic pool.
250 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
252 ## [2.4.0] - 2023-04-04
256 - Add `LESS_BUSY` worker choice strategy.
260 - Optimize worker storage in pool.
261 - Optimize worker alive status check.
262 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
263 - Optimize `LESS_USED` worker choice strategy.
264 - Update benchmarks versus external threads pools.
265 - Optimize tasks usage statistics requirements for worker choice strategy.
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-3] - 2023-04-04
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.
286 - Update benchmarks versus external threads pools.
290 - Ensure trimmable characters are checked at pool initialization.
291 - Fix message id integer overflow.
292 - Fix pool worker removal in worker choice strategy internals.
293 - Fix package publication with pnpm.
295 ## [2.4.0-2] - 2023-04-03
299 - Add `LESS_BUSY` worker choice strategy.
303 - Optimize worker storage in pool.
304 - Optimize worker alive status check.
305 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
306 - Optimize `LESS_USED` worker choice strategy.
310 - Ensure trimmable characters are checked at pool initialization.
311 - Fix message id integer overflow.
312 - Fix pool worker removal in worker choice strategy internals.
313 - Fix package publication with pnpm.
315 ## [2.4.0-1] - 2023-04-03
319 - Add `LESS_BUSY` worker choice strategy.
323 - Optimize worker storage in pool.
324 - Optimize worker alive status check.
325 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
326 - Optimize `LESS_USED` worker choice strategy.
330 - Ensure trimmable characters are checked at pool initialization.
331 - Fix message id integer overflow.
332 - Fix pool worker removal in worker choice strategy internals.
334 ## [2.4.0-0] - 2023-04-03
338 - Add `LESS_BUSY` worker choice strategy.
342 - Optimize worker storage in pool.
343 - Optimize worker alive status check.
344 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
345 - Optimize `LESS_USED` worker choice strategy.
349 - Ensure trimmable characters are checked at pool initialization.
350 - Fix message id integer overflow.
351 - Fix pool worker removal in worker choice strategy internals.
353 ## [2.3.10] - 2023-03-18
357 - Fix `exports` syntax for ESM and CommonJS.
361 - Permit SemVer pre-release publication.
363 ## [2.3.10-2] - 2023-03-18
367 - Fix `exports` syntax for ESM and CommonJS.
369 ## [2.3.10-1] - 2023-03-18
373 - Permit SemVer pre-release publication.
375 ## [2.3.10-0] - 2023-03-18
379 - Fix `exports` syntax for ESM and CommonJS.
381 ## [2.3.9] - 2023-03-18
385 - Introduce ESM module support along with CommonJS one.
389 - Fix brown paper bag bug referencing the same object literal.
391 ## [2.3.8] - 2023-03-18
395 - Switch internal benchmarking code to benny.
396 - Switch to TypeScript 5.x.x.
397 - Switch rollup bundler plugins to core ones.
398 - Switch to TSDoc syntax.
399 - Enforce conventional commits.
403 - Fix random integer generator.
404 - Fix worker choice strategy pool type identification at initialization.
406 ## [2.3.7] - 2022-10-23
410 - Switch to open collective FOSS project funding platform.
411 - Switch to ts-standard linter configuration on TypeScript code.
415 - Fixed missing async on pool execute method.
416 - Fixed typing in TypeScript example.
417 - Fixed types in unit tests.
419 ## [2.3.6] - 2022-10-22
423 - Cleanup pool attributes and methods.
424 - Refine error types thrown.
428 - Fix continuous integration build on windows.
429 - Fix code coverage reporting by using c8 instead of nyc.
431 ## [2.3.5] - 2022-10-21
435 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
436 - Optimize tasks usage lookup implementation.
440 - Fix missed pool event emitter type export.
441 - Fix typedoc documentation generation.
443 ## [2.3.4] - 2022-10-17
447 - Fully automate release process with release-it.
451 - Optimize fair share task scheduling algorithm implementation.
452 - Update benchmarks versus external pools results with latest version.
454 ## [2.3.3] - 2022-10-15
458 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
460 ## [2.3.2] - 2022-10-14
464 - Optimize fair share worker selection strategy implementation.
468 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
470 ## [2.3.1] - 2022-10-13
474 - Pool worker choice strategies:
475 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
476 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
478 ## [2.2.2] - 2022-10-09
482 - Fixed `README.md` file.
484 ## [2.2.1] - 2022-10-08
488 - Dynamic worker choice strategy change at runtime.
490 ## [2.2.0] - 2022-01-05
494 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
496 ## [2.1.0] - 2021-08-29
500 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
504 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
505 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
506 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
507 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
509 ## [2.0.2] - 2021-05-12
513 - Fix `busy` event emission on fixed pool type
515 ## [2.0.1] - 2021-03-16
519 - Check if pool options are properly set.
520 - `busy` event is emitted on all pool types.
522 ## [2.0.0] - 2021-03-01
526 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
530 - `FullPool` event is now renamed to `busy`.
531 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
532 _Find more details on our JSDoc._
534 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
536 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
538 ### Pool options types declaration merge
540 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
542 #### New `export` strategy
546 const DynamicThreadPool = require('poolifier/lib/dynamic')
548 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
551 But you should always prefer just using
554 const { DynamicThreadPool } = require('poolifier')
557 #### New type definitions for input data and response
559 For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data.
560 _This is not a limitation by poolifier but NodeJS._
562 #### Public property replacements
564 `numWorkers` property is now `numberOfWorkers`
566 #### Internal (protected) properties and methods renaming
568 These properties are not intended for end users
570 - `id` => `nextMessageId`
572 These methods are not intended for end users
574 - `_chooseWorker` => `chooseWorker`
575 - `_newWorker` => `createWorker`
576 - `_execute` => `internalExecute`
577 - `_chooseWorker` => `chooseWorker`
578 - `_checkAlive` => `checkAlive`
580 - `_runAsync` => `runAsync`
582 ## [1.1.0] - 2020-05-21
586 - ThreadWorker support async functions as option
587 - Various external library patches
589 ## [1.0.0] - 2020-01-24
593 - FixedThreadPool implementation
594 - DynamicThreadPool implementation
595 - WorkerThread implementation to improve developer experience