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 - Add Event Loop Utilization (ELU) statistics to worker tasks usage.
16 - Compute statistics at the worker level only if needed.
20 - Make the `LEAST_BUSY` strategy only relies on task runtime.
22 ## [2.5.3] - 2023-06-04
26 - Refine pool information content.
27 - Limit pool internals public exposure.
29 ## [2.5.2] - 2023-06-02
33 - Add `taskError` pool event for task execution error.
34 - Add pool information `info` property to pool.
35 - Emit pool information on `busy` and `full` pool events.
37 ## [2.5.1] - 2023-06-01
41 - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
42 - Add `error` pool event for uncaught worker error.
44 ## [2.5.0] - 2023-05-31
48 - Switch pool event emitter to `EventEmitterAsyncResource`.
49 - Add tasks wait time accounting in per worker tasks usage.
50 - Add interleaved weighted round robin worker choice strategy (experimental).
54 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
56 ## [2.4.14] - 2023-05-09
60 - Ensure no undefined task runtime can land in the tasks history.
61 - Fix median computation implementation once again.
65 - Unit tests for median and queue implementations.
67 ## [2.4.13] - 2023-05-08
71 - Fix worker choice strategy options validation.
72 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
74 ## [2.4.12] - 2023-05-06
78 - Support multiple task functions per worker.
79 - Add custom worker weights support to worker choice strategies options.
83 - Use O(1) queue implementation for tasks queueing.
87 - Fix median computation implementation.
88 - Fix fair share worker choice strategy internals update.
90 ## [2.4.11] - 2023-04-23
94 - Optimize free worker finding in worker choice strategies.
96 ## [2.4.10] - 2023-04-15
100 - Fix typescript type definition for worker function: ensure the input data is optional.
101 - Fix typescript type definition for pool execute(): ensure the input data is optional.
103 ## [2.4.9] - 2023-04-15
107 - Add tasks queue enablement runtime setter to pool.
108 - Add tasks queue options runtime setter to pool.
109 - Add worker choice strategy options runtime setter to pool.
113 - Remove the tasks queuing experimental status.
117 - Fix worker function type definition and validation.
118 - Fix worker choice strategy options handling.
120 ## [2.4.8] - 2023-04-12
124 - Fix message between main worker and worker type definition for tasks.
125 - Fix code documentation.
127 ## [2.4.7] - 2023-04-11
131 - Add worker tasks queue options to pool options.
135 - Fix missing documentation.
137 ## [2.4.6] - 2023-04-10
141 - Ensure one task at a time is executed per worker with tasks queueing enabled.
142 - Properly count worker running tasks with tasks queueing enabled.
144 ## [2.4.5] - 2023-04-09
148 - Use monotonic high resolution timer for worker tasks runtime.
149 - Add worker tasks median runtime to statistics.
150 - Add worker tasks queue (experimental).
152 ## [2.4.4] - 2023-04-07
156 - Add `PoolEvents` enumeration and `PoolEvent` type.
160 - Destroy worker only on alive check.
162 ## [2.4.3] - 2023-04-07
166 - Fix typedoc generation with inheritance.
168 ## [2.4.2] - 2023-04-06
172 - Add `full` event to dynamic pool.
173 - Keep worker choice strategy in memory for conditional reuse.
177 - Fix possible negative worker key at worker removal in worker choice strategies.
179 ## [2.4.1] - 2023-04-05
183 - Optimize worker choice strategy for dynamic pool.
187 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
189 ## [2.4.0] - 2023-04-04
193 - Add `LESS_BUSY` worker choice strategy.
197 - Optimize worker storage in pool.
198 - Optimize worker alive status check.
199 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
200 - Optimize `LESS_USED` worker choice strategy.
201 - Update benchmarks versus external threads pools.
202 - Optimize tasks usage statistics requirements for worker choice strategy.
206 - Ensure trimmable characters are checked at pool initialization.
207 - Fix message id integer overflow.
208 - Fix pool worker removal in worker choice strategy internals.
209 - Fix package publication with pnpm.
211 ## [2.4.0-3] - 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.
227 - Ensure trimmable characters are checked at pool initialization.
228 - Fix message id integer overflow.
229 - Fix pool worker removal in worker choice strategy internals.
230 - Fix package publication with pnpm.
232 ## [2.4.0-2] - 2023-04-03
236 - Add `LESS_BUSY` worker choice strategy.
240 - Optimize worker storage in pool.
241 - Optimize worker alive status check.
242 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
243 - Optimize `LESS_USED` worker choice strategy.
247 - Ensure trimmable characters are checked at pool initialization.
248 - Fix message id integer overflow.
249 - Fix pool worker removal in worker choice strategy internals.
250 - Fix package publication with pnpm.
252 ## [2.4.0-1] - 2023-04-03
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.
267 - Ensure trimmable characters are checked at pool initialization.
268 - Fix message id integer overflow.
269 - Fix pool worker removal in worker choice strategy internals.
271 ## [2.4.0-0] - 2023-04-03
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.
286 - Ensure trimmable characters are checked at pool initialization.
287 - Fix message id integer overflow.
288 - Fix pool worker removal in worker choice strategy internals.
290 ## [2.3.10] - 2023-03-18
294 - Fix `exports` syntax for ESM and CommonJS.
298 - Permit SemVer pre-release publication.
300 ## [2.3.10-2] - 2023-03-18
304 - Fix `exports` syntax for ESM and CommonJS.
306 ## [2.3.10-1] - 2023-03-18
310 - Permit SemVer pre-release publication.
312 ## [2.3.10-0] - 2023-03-18
316 - Fix `exports` syntax for ESM and CommonJS.
318 ## [2.3.9] - 2023-03-18
322 - Introduce ESM module support along with CommonJS one.
326 - Fix brown paper bag bug referencing the same object literal.
328 ## [2.3.8] - 2023-03-18
332 - Switch internal benchmarking code to benny.
333 - Switch to TypeScript 5.x.x.
334 - Switch rollup bundler plugins to core ones.
335 - Switch to TSDoc syntax.
336 - Enforce conventional commits.
340 - Fix random integer generator.
341 - Fix worker choice strategy pool type identification at initialization.
343 ## [2.3.7] - 2022-10-23
347 - Switch to open collective FOSS project funding platform.
348 - Switch to ts-standard linter configuration on TypeScript code.
352 - Fixed missing async on pool execute method.
353 - Fixed typing in TypeScript example.
354 - Fixed types in unit tests.
356 ## [2.3.6] - 2022-10-22
360 - Cleanup pool attributes and methods.
361 - Refine error types thrown.
365 - Fix continuous integration build on windows.
366 - Fix code coverage reporting by using c8 instead of nyc.
368 ## [2.3.5] - 2022-10-21
372 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
373 - Optimize tasks usage lookup implementation.
377 - Fix missed pool event emitter type export.
378 - Fix typedoc documentation generation.
380 ## [2.3.4] - 2022-10-17
384 - Fully automate release process with release-it.
388 - Optimize fair share task scheduling algorithm implementation.
389 - Update benchmarks versus external pools results with latest version.
391 ## [2.3.3] - 2022-10-15
395 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
397 ## [2.3.2] - 2022-10-14
401 - Optimize fair share worker selection strategy implementation.
405 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
407 ## [2.3.1] - 2022-10-13
411 - Pool worker choice strategies:
412 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
413 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
415 ## [2.2.2] - 2022-10-09
419 - Fixed `README.md` file.
421 ## [2.2.1] - 2022-10-08
425 - Dynamic worker choice strategy change at runtime.
427 ## [2.2.0] - 2022-01-05
431 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
433 ## [2.1.0] - 2021-08-29
437 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
441 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
442 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
443 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
444 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
446 ## [2.0.2] - 2021-05-12
450 - Fix `busy` event emission on fixed pool type
452 ## [2.0.1] - 2021-03-16
456 - Check if pool options are properly set.
457 - `busy` event is emitted on all pool types.
459 ## [2.0.0] - 2021-03-01
463 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
467 - `FullPool` event is now renamed to `busy`.
468 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
469 _Find more details on our JSDoc._
471 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
473 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
475 ### Pool options types declaration merge
477 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
479 #### New `export` strategy
483 const DynamicThreadPool = require('poolifier/lib/dynamic')
485 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
488 But you should always prefer just using
491 const { DynamicThreadPool } = require('poolifier')
494 #### New type definitions for input data and response
496 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
497 _This is not a limitation by poolifier but NodeJS._
499 #### Public property replacements
501 `numWorkers` property is now `numberOfWorkers`
503 #### Internal (protected) properties and methods renaming
505 These properties are not intended for end users
507 - `id` => `nextMessageId`
509 These methods are not intended for end users
511 - `_chooseWorker` => `chooseWorker`
512 - `_newWorker` => `createWorker`
513 - `_execute` => `internalExecute`
514 - `_chooseWorker` => `chooseWorker`
515 - `_checkAlive` => `checkAlive`
517 - `_runAsync` => `runAsync`
519 ## [1.1.0] - 2020-05-21
523 - ThreadWorker support async functions as option
524 - Various external library patches
526 ## [1.0.0] - 2020-01-24
530 - FixedThreadPool implementation
531 - DynamicThreadPool implementation
532 - WorkerThread implementation to improve developer experience