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.5] - 2023-06-27
14 - Cluster pools tasks execution are not working: https://github.com/poolifier/poolifier/issues/782
18 - Artificial version bump to 2.6.5 to workaround publication issue.
19 - Ensure cluster pool destroy() gracefully shutdowns worker's server.
20 - Ensure pool event is emitted before task error promise rejection.
21 - Fix queued tasks count computation.
25 - Remove unneeded worker-threads worker `MessageChannel` internal usage for IPC.
27 ## [2.6.4] - 2023-06-27
31 - Cluster pools tasks execution are not working: https://github.com/poolifier/poolifier/issues/782
35 - Ensure cluster pool destroy() gracefully shutdowns worker's server.
36 - Ensure pool event is emitted before task error promise rejection.
37 - Fix queued tasks count computation.
41 - Remove unneeded worker-threads worker `MessageChannel` internal usage for IPC.
43 ## [2.6.3] - 2023-06-19
47 - Ensure no tasks are queued when trying to soft kill a dynamic worker.
48 - Update strategies internals after statistics computation.
52 - Optimize O(1) queue implementation.
54 ## [2.6.2] - 2023-06-12
58 - Fix new worker use after creation in dynamic pool given the current worker choice strategy.
60 ## [2.6.1] - 2023-06-10
64 - Add worker choice strategy documentation: [README.md](./src/pools/selection-strategies/README.md).
68 - Fix average statistics computation: ensure failed tasks are not accounted.
70 ## [2.6.0] - 2023-06-09
74 - Add `LEAST_ELU` worker choice strategy (experimental).
75 - Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
79 - Refactor pool worker node usage internals.
80 - Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
81 - Breaking change: pool information `info` property object fields have been renamed.
85 - Fix wait time accounting.
86 - Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
87 - Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
89 ## [2.5.4] - 2023-06-07
93 - Add Event Loop Utilization (ELU) statistics to worker tasks usage.
97 - Compute statistics at the worker level only if needed.
98 - Add `worker-threads` options to thread pool options.
102 - Make the `LEAST_BUSY` strategy only relies on task runtime.
104 ## [2.5.3] - 2023-06-04
108 - Refine pool information content.
109 - Limit pool internals public exposure.
111 ## [2.5.2] - 2023-06-02
115 - Add `taskError` pool event for task execution error.
116 - Add pool information `info` property to pool.
117 - Emit pool information on `busy` and `full` pool events.
119 ## [2.5.1] - 2023-06-01
123 - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
124 - Add `error` pool event for uncaught worker error.
126 ## [2.5.0] - 2023-05-31
130 - Switch pool event emitter to `EventEmitterAsyncResource`.
131 - Add tasks wait time accounting in per worker tasks usage.
132 - Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
136 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
138 ## [2.4.14] - 2023-05-09
142 - Ensure no undefined task runtime can land in the tasks history.
143 - Fix median computation implementation once again.
147 - Unit tests for median and queue implementations.
149 ## [2.4.13] - 2023-05-08
153 - Fix worker choice strategy options validation.
154 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
156 ## [2.4.12] - 2023-05-06
160 - Support multiple task functions per worker.
161 - Add custom worker weights support to worker choice strategies options.
165 - Use O(1) queue implementation for tasks queueing.
169 - Fix median computation implementation.
170 - Fix fair share worker choice strategy internals update.
172 ## [2.4.11] - 2023-04-23
176 - Optimize free worker finding in worker choice strategies.
178 ## [2.4.10] - 2023-04-15
182 - Fix typescript type definition for worker function: ensure the input data is optional.
183 - Fix typescript type definition for pool execute(): ensure the input data is optional.
185 ## [2.4.9] - 2023-04-15
189 - Add tasks queue enablement runtime setter to pool.
190 - Add tasks queue options runtime setter to pool.
191 - Add worker choice strategy options runtime setter to pool.
195 - Remove the tasks queuing experimental status.
199 - Fix worker function type definition and validation.
200 - Fix worker choice strategy options handling.
202 ## [2.4.8] - 2023-04-12
206 - Fix message between main worker and worker type definition for tasks.
207 - Fix code documentation.
209 ## [2.4.7] - 2023-04-11
213 - Add worker tasks queue options to pool options.
217 - Fix missing documentation.
219 ## [2.4.6] - 2023-04-10
223 - Ensure one task at a time is executed per worker with tasks queueing enabled.
224 - Properly count worker executing tasks with tasks queueing enabled.
226 ## [2.4.5] - 2023-04-09
230 - Use monotonic high resolution timer for worker tasks runtime.
231 - Add worker tasks median runtime to statistics.
232 - Add worker tasks queue (experimental).
234 ## [2.4.4] - 2023-04-07
238 - Add `PoolEvents` enumeration and `PoolEvent` type.
242 - Destroy worker only on alive check.
244 ## [2.4.3] - 2023-04-07
248 - Fix typedoc generation with inheritance.
250 ## [2.4.2] - 2023-04-06
254 - Add `full` event to dynamic pool.
255 - Keep worker choice strategy in memory for conditional reuse.
259 - Fix possible negative worker key at worker removal in worker choice strategies.
261 ## [2.4.1] - 2023-04-05
265 - Optimize worker choice strategy for dynamic pool.
269 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
271 ## [2.4.0] - 2023-04-04
275 - Add `LESS_BUSY` worker choice strategy.
279 - Optimize worker storage in pool.
280 - Optimize worker alive status check.
281 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
282 - Optimize `LESS_USED` worker choice strategy.
283 - Update benchmarks versus external threads pools.
284 - Optimize tasks usage statistics requirements for worker choice strategy.
288 - Ensure trimmable characters are checked at pool initialization.
289 - Fix message id integer overflow.
290 - Fix pool worker removal in worker choice strategy internals.
291 - Fix package publication with pnpm.
293 ## [2.4.0-3] - 2023-04-04
297 - Add `LESS_BUSY` worker choice strategy.
301 - Optimize worker storage in pool.
302 - Optimize worker alive status check.
303 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
304 - Optimize `LESS_USED` worker choice strategy.
305 - Update benchmarks versus external threads pools.
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.
312 - Fix package publication with pnpm.
314 ## [2.4.0-2] - 2023-04-03
318 - Add `LESS_BUSY` worker choice strategy.
322 - Optimize worker storage in pool.
323 - Optimize worker alive status check.
324 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
325 - Optimize `LESS_USED` worker choice strategy.
329 - Ensure trimmable characters are checked at pool initialization.
330 - Fix message id integer overflow.
331 - Fix pool worker removal in worker choice strategy internals.
332 - Fix package publication with pnpm.
334 ## [2.4.0-1] - 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.4.0-0] - 2023-04-03
357 - Add `LESS_BUSY` worker choice strategy.
361 - Optimize worker storage in pool.
362 - Optimize worker alive status check.
363 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
364 - Optimize `LESS_USED` worker choice strategy.
368 - Ensure trimmable characters are checked at pool initialization.
369 - Fix message id integer overflow.
370 - Fix pool worker removal in worker choice strategy internals.
372 ## [2.3.10] - 2023-03-18
376 - Fix `exports` syntax for ESM and CommonJS.
380 - Permit SemVer pre-release publication.
382 ## [2.3.10-2] - 2023-03-18
386 - Fix `exports` syntax for ESM and CommonJS.
388 ## [2.3.10-1] - 2023-03-18
392 - Permit SemVer pre-release publication.
394 ## [2.3.10-0] - 2023-03-18
398 - Fix `exports` syntax for ESM and CommonJS.
400 ## [2.3.9] - 2023-03-18
404 - Introduce ESM module support along with CommonJS one.
408 - Fix brown paper bag bug referencing the same object literal.
410 ## [2.3.8] - 2023-03-18
414 - Switch internal benchmarking code to benny.
415 - Switch to TypeScript 5.x.x.
416 - Switch rollup bundler plugins to core ones.
417 - Switch to TSDoc syntax.
418 - Enforce conventional commits.
422 - Fix random integer generator.
423 - Fix worker choice strategy pool type identification at initialization.
425 ## [2.3.7] - 2022-10-23
429 - Switch to open collective FOSS project funding platform.
430 - Switch to ts-standard linter configuration on TypeScript code.
434 - Fixed missing async on pool execute method.
435 - Fixed typing in TypeScript example.
436 - Fixed types in unit tests.
438 ## [2.3.6] - 2022-10-22
442 - Cleanup pool attributes and methods.
443 - Refine error types thrown.
447 - Fix continuous integration build on windows.
448 - Fix code coverage reporting by using c8 instead of nyc.
450 ## [2.3.5] - 2022-10-21
454 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
455 - Optimize tasks usage lookup implementation.
459 - Fix missed pool event emitter type export.
460 - Fix typedoc documentation generation.
462 ## [2.3.4] - 2022-10-17
466 - Fully automate release process with release-it.
470 - Optimize fair share task scheduling algorithm implementation.
471 - Update benchmarks versus external pools results with latest version.
473 ## [2.3.3] - 2022-10-15
477 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
479 ## [2.3.2] - 2022-10-14
483 - Optimize fair share worker selection strategy implementation.
487 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
489 ## [2.3.1] - 2022-10-13
493 - Pool worker choice strategies:
494 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
495 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
497 ## [2.2.2] - 2022-10-09
501 - Fixed `README.md` file.
503 ## [2.2.1] - 2022-10-08
507 - Dynamic worker choice strategy change at runtime.
509 ## [2.2.0] - 2022-01-05
513 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
515 ## [2.1.0] - 2021-08-29
519 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
523 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
524 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
525 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
526 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
528 ## [2.0.2] - 2021-05-12
532 - Fix `busy` event emission on fixed pool type
534 ## [2.0.1] - 2021-03-16
538 - Check if pool options are properly set.
539 - `busy` event is emitted on all pool types.
541 ## [2.0.0] - 2021-03-01
545 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
549 - `FullPool` event is now renamed to `busy`.
550 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
551 _Find more details on our JSDoc._
553 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
555 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
557 ### Pool options types declaration merge
559 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
561 #### New `export` strategy
565 const DynamicThreadPool = require('poolifier/lib/dynamic')
567 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
570 But you should always prefer just using
573 const { DynamicThreadPool } = require('poolifier')
576 #### New type definitions for input data and response
578 For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data.
579 _This is not a limitation by poolifier but NodeJS._
581 #### Public property replacements
583 `numWorkers` property is now `numberOfWorkers`
585 #### Internal (protected) properties and methods renaming
587 These properties are not intended for end users
589 - `id` => `nextMessageId`
591 These methods are not intended for end users
593 - `_chooseWorker` => `chooseWorker`
594 - `_newWorker` => `createWorker`
595 - `_execute` => `internalExecute`
596 - `_chooseWorker` => `chooseWorker`
597 - `_checkAlive` => `checkAlive`
599 - `_runAsync` => `runAsync`
601 ## [1.1.0] - 2020-05-21
605 - ThreadWorker support async functions as option
606 - Various external library patches
608 ## [1.0.0] - 2020-01-24
612 - FixedThreadPool implementation
613 - DynamicThreadPool implementation
614 - WorkerThread implementation to improve developer experience