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.0] - 2023-06-09
14 - Add `LEAST_ELU` worker choice strategy (experimental).
15 - Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
19 - Refactor pool worker node usage internals.
20 - Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
21 - Breaking change: pool information `info` property object fields have been renamed.
25 - Fix wait time accounting.
26 - Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
27 - Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
29 ## [2.5.4] - 2023-06-07
33 - Add Event Loop Utilization (ELU) statistics to worker tasks usage.
37 - Compute statistics at the worker level only if needed.
38 - Add `worker-threads` options to thread pool options.
42 - Make the `LEAST_BUSY` strategy only relies on task runtime.
44 ## [2.5.3] - 2023-06-04
48 - Refine pool information content.
49 - Limit pool internals public exposure.
51 ## [2.5.2] - 2023-06-02
55 - Add `taskError` pool event for task execution error.
56 - Add pool information `info` property to pool.
57 - Emit pool information on `busy` and `full` pool events.
59 ## [2.5.1] - 2023-06-01
63 - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
64 - Add `error` pool event for uncaught worker error.
66 ## [2.5.0] - 2023-05-31
70 - Switch pool event emitter to `EventEmitterAsyncResource`.
71 - Add tasks wait time accounting in per worker tasks usage.
72 - Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
76 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
78 ## [2.4.14] - 2023-05-09
82 - Ensure no undefined task runtime can land in the tasks history.
83 - Fix median computation implementation once again.
87 - Unit tests for median and queue implementations.
89 ## [2.4.13] - 2023-05-08
93 - Fix worker choice strategy options validation.
94 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
96 ## [2.4.12] - 2023-05-06
100 - Support multiple task functions per worker.
101 - Add custom worker weights support to worker choice strategies options.
105 - Use O(1) queue implementation for tasks queueing.
109 - Fix median computation implementation.
110 - Fix fair share worker choice strategy internals update.
112 ## [2.4.11] - 2023-04-23
116 - Optimize free worker finding in worker choice strategies.
118 ## [2.4.10] - 2023-04-15
122 - Fix typescript type definition for worker function: ensure the input data is optional.
123 - Fix typescript type definition for pool execute(): ensure the input data is optional.
125 ## [2.4.9] - 2023-04-15
129 - Add tasks queue enablement runtime setter to pool.
130 - Add tasks queue options runtime setter to pool.
131 - Add worker choice strategy options runtime setter to pool.
135 - Remove the tasks queuing experimental status.
139 - Fix worker function type definition and validation.
140 - Fix worker choice strategy options handling.
142 ## [2.4.8] - 2023-04-12
146 - Fix message between main worker and worker type definition for tasks.
147 - Fix code documentation.
149 ## [2.4.7] - 2023-04-11
153 - Add worker tasks queue options to pool options.
157 - Fix missing documentation.
159 ## [2.4.6] - 2023-04-10
163 - Ensure one task at a time is executed per worker with tasks queueing enabled.
164 - Properly count worker executing tasks with tasks queueing enabled.
166 ## [2.4.5] - 2023-04-09
170 - Use monotonic high resolution timer for worker tasks runtime.
171 - Add worker tasks median runtime to statistics.
172 - Add worker tasks queue (experimental).
174 ## [2.4.4] - 2023-04-07
178 - Add `PoolEvents` enumeration and `PoolEvent` type.
182 - Destroy worker only on alive check.
184 ## [2.4.3] - 2023-04-07
188 - Fix typedoc generation with inheritance.
190 ## [2.4.2] - 2023-04-06
194 - Add `full` event to dynamic pool.
195 - Keep worker choice strategy in memory for conditional reuse.
199 - Fix possible negative worker key at worker removal in worker choice strategies.
201 ## [2.4.1] - 2023-04-05
205 - Optimize worker choice strategy for dynamic pool.
209 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
211 ## [2.4.0] - 2023-04-04
215 - Add `LESS_BUSY` worker choice strategy.
219 - Optimize worker storage in pool.
220 - Optimize worker alive status check.
221 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
222 - Optimize `LESS_USED` worker choice strategy.
223 - Update benchmarks versus external threads pools.
224 - Optimize tasks usage statistics requirements for worker choice strategy.
228 - Ensure trimmable characters are checked at pool initialization.
229 - Fix message id integer overflow.
230 - Fix pool worker removal in worker choice strategy internals.
231 - Fix package publication with pnpm.
233 ## [2.4.0-3] - 2023-04-04
237 - Add `LESS_BUSY` worker choice strategy.
241 - Optimize worker storage in pool.
242 - Optimize worker alive status check.
243 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
244 - Optimize `LESS_USED` worker choice strategy.
245 - Update benchmarks versus external threads pools.
249 - Ensure trimmable characters are checked at pool initialization.
250 - Fix message id integer overflow.
251 - Fix pool worker removal in worker choice strategy internals.
252 - Fix package publication with pnpm.
254 ## [2.4.0-2] - 2023-04-03
258 - Add `LESS_BUSY` worker choice strategy.
262 - Optimize worker storage in pool.
263 - Optimize worker alive status check.
264 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
265 - Optimize `LESS_USED` 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-1] - 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.
293 ## [2.4.0-0] - 2023-04-03
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.
308 - Ensure trimmable characters are checked at pool initialization.
309 - Fix message id integer overflow.
310 - Fix pool worker removal in worker choice strategy internals.
312 ## [2.3.10] - 2023-03-18
316 - Fix `exports` syntax for ESM and CommonJS.
320 - Permit SemVer pre-release publication.
322 ## [2.3.10-2] - 2023-03-18
326 - Fix `exports` syntax for ESM and CommonJS.
328 ## [2.3.10-1] - 2023-03-18
332 - Permit SemVer pre-release publication.
334 ## [2.3.10-0] - 2023-03-18
338 - Fix `exports` syntax for ESM and CommonJS.
340 ## [2.3.9] - 2023-03-18
344 - Introduce ESM module support along with CommonJS one.
348 - Fix brown paper bag bug referencing the same object literal.
350 ## [2.3.8] - 2023-03-18
354 - Switch internal benchmarking code to benny.
355 - Switch to TypeScript 5.x.x.
356 - Switch rollup bundler plugins to core ones.
357 - Switch to TSDoc syntax.
358 - Enforce conventional commits.
362 - Fix random integer generator.
363 - Fix worker choice strategy pool type identification at initialization.
365 ## [2.3.7] - 2022-10-23
369 - Switch to open collective FOSS project funding platform.
370 - Switch to ts-standard linter configuration on TypeScript code.
374 - Fixed missing async on pool execute method.
375 - Fixed typing in TypeScript example.
376 - Fixed types in unit tests.
378 ## [2.3.6] - 2022-10-22
382 - Cleanup pool attributes and methods.
383 - Refine error types thrown.
387 - Fix continuous integration build on windows.
388 - Fix code coverage reporting by using c8 instead of nyc.
390 ## [2.3.5] - 2022-10-21
394 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
395 - Optimize tasks usage lookup implementation.
399 - Fix missed pool event emitter type export.
400 - Fix typedoc documentation generation.
402 ## [2.3.4] - 2022-10-17
406 - Fully automate release process with release-it.
410 - Optimize fair share task scheduling algorithm implementation.
411 - Update benchmarks versus external pools results with latest version.
413 ## [2.3.3] - 2022-10-15
417 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
419 ## [2.3.2] - 2022-10-14
423 - Optimize fair share worker selection strategy implementation.
427 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
429 ## [2.3.1] - 2022-10-13
433 - Pool worker choice strategies:
434 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
435 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
437 ## [2.2.2] - 2022-10-09
441 - Fixed `README.md` file.
443 ## [2.2.1] - 2022-10-08
447 - Dynamic worker choice strategy change at runtime.
449 ## [2.2.0] - 2022-01-05
453 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
455 ## [2.1.0] - 2021-08-29
459 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
463 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
464 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
465 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
466 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
468 ## [2.0.2] - 2021-05-12
472 - Fix `busy` event emission on fixed pool type
474 ## [2.0.1] - 2021-03-16
478 - Check if pool options are properly set.
479 - `busy` event is emitted on all pool types.
481 ## [2.0.0] - 2021-03-01
485 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
489 - `FullPool` event is now renamed to `busy`.
490 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
491 _Find more details on our JSDoc._
493 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
495 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
497 ### Pool options types declaration merge
499 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
501 #### New `export` strategy
505 const DynamicThreadPool = require('poolifier/lib/dynamic')
507 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
510 But you should always prefer just using
513 const { DynamicThreadPool } = require('poolifier')
516 #### New type definitions for input data and response
518 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
519 _This is not a limitation by poolifier but NodeJS._
521 #### Public property replacements
523 `numWorkers` property is now `numberOfWorkers`
525 #### Internal (protected) properties and methods renaming
527 These properties are not intended for end users
529 - `id` => `nextMessageId`
531 These methods are not intended for end users
533 - `_chooseWorker` => `chooseWorker`
534 - `_newWorker` => `createWorker`
535 - `_execute` => `internalExecute`
536 - `_chooseWorker` => `chooseWorker`
537 - `_checkAlive` => `checkAlive`
539 - `_runAsync` => `runAsync`
541 ## [1.1.0] - 2020-05-21
545 - ThreadWorker support async functions as option
546 - Various external library patches
548 ## [1.0.0] - 2020-01-24
552 - FixedThreadPool implementation
553 - DynamicThreadPool implementation
554 - WorkerThread implementation to improve developer experience