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 - Artificial version bump to 2.6.5 to workaround publication issue.
17 - Ensure cluster pool destroy() gracefully shutdowns worker's server.
18 - Ensure pool event is emitted before task error promise rejection.
19 - Fix queued tasks count computation.
23 - Remove unneeded worker-threads worker `MessageChannel` internal usage for IPC.
25 ## [2.6.4] - 2023-06-27
29 - Cluster pools tasks execution are not working: https://github.com/poolifier/poolifier/issues/782
33 - Ensure cluster pool destroy() gracefully shutdowns worker's server.
34 - Ensure pool event is emitted before task error promise rejection.
35 - Fix queued tasks count computation.
39 - Remove unneeded worker-threads worker `MessageChannel` internal usage for IPC.
41 ## [2.6.3] - 2023-06-19
45 - Ensure no tasks are queued when trying to soft kill a dynamic worker.
46 - Update strategies internals after statistics computation.
50 - Optimize O(1) queue implementation.
52 ## [2.6.2] - 2023-06-12
56 - Fix new worker use after creation in dynamic pool given the current worker choice strategy.
58 ## [2.6.1] - 2023-06-10
62 - Add worker choice strategy documentation: [README.md](./src/pools/selection-strategies/README.md).
66 - Fix average statistics computation: ensure failed tasks are not accounted.
68 ## [2.6.0] - 2023-06-09
72 - Add `LEAST_ELU` worker choice strategy (experimental).
73 - Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
77 - Refactor pool worker node usage internals.
78 - Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
79 - Breaking change: pool information `info` property object fields have been renamed.
83 - Fix wait time accounting.
84 - Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
85 - Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
87 ## [2.5.4] - 2023-06-07
91 - Add Event Loop Utilization (ELU) statistics to worker tasks usage.
95 - Compute statistics at the worker level only if needed.
96 - Add `worker-threads` options to thread pool options.
100 - Make the `LEAST_BUSY` strategy only relies on task runtime.
102 ## [2.5.3] - 2023-06-04
106 - Refine pool information content.
107 - Limit pool internals public exposure.
109 ## [2.5.2] - 2023-06-02
113 - Add `taskError` pool event for task execution error.
114 - Add pool information `info` property to pool.
115 - Emit pool information on `busy` and `full` pool events.
117 ## [2.5.1] - 2023-06-01
121 - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
122 - Add `error` pool event for uncaught worker error.
124 ## [2.5.0] - 2023-05-31
128 - Switch pool event emitter to `EventEmitterAsyncResource`.
129 - Add tasks wait time accounting in per worker tasks usage.
130 - Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
134 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
136 ## [2.4.14] - 2023-05-09
140 - Ensure no undefined task runtime can land in the tasks history.
141 - Fix median computation implementation once again.
145 - Unit tests for median and queue implementations.
147 ## [2.4.13] - 2023-05-08
151 - Fix worker choice strategy options validation.
152 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
154 ## [2.4.12] - 2023-05-06
158 - Support multiple task functions per worker.
159 - Add custom worker weights support to worker choice strategies options.
163 - Use O(1) queue implementation for tasks queueing.
167 - Fix median computation implementation.
168 - Fix fair share worker choice strategy internals update.
170 ## [2.4.11] - 2023-04-23
174 - Optimize free worker finding in worker choice strategies.
176 ## [2.4.10] - 2023-04-15
180 - Fix typescript type definition for worker function: ensure the input data is optional.
181 - Fix typescript type definition for pool execute(): ensure the input data is optional.
183 ## [2.4.9] - 2023-04-15
187 - Add tasks queue enablement runtime setter to pool.
188 - Add tasks queue options runtime setter to pool.
189 - Add worker choice strategy options runtime setter to pool.
193 - Remove the tasks queuing experimental status.
197 - Fix worker function type definition and validation.
198 - Fix worker choice strategy options handling.
200 ## [2.4.8] - 2023-04-12
204 - Fix message between main worker and worker type definition for tasks.
205 - Fix code documentation.
207 ## [2.4.7] - 2023-04-11
211 - Add worker tasks queue options to pool options.
215 - Fix missing documentation.
217 ## [2.4.6] - 2023-04-10
221 - Ensure one task at a time is executed per worker with tasks queueing enabled.
222 - Properly count worker executing tasks with tasks queueing enabled.
224 ## [2.4.5] - 2023-04-09
228 - Use monotonic high resolution timer for worker tasks runtime.
229 - Add worker tasks median runtime to statistics.
230 - Add worker tasks queue (experimental).
232 ## [2.4.4] - 2023-04-07
236 - Add `PoolEvents` enumeration and `PoolEvent` type.
240 - Destroy worker only on alive check.
242 ## [2.4.3] - 2023-04-07
246 - Fix typedoc generation with inheritance.
248 ## [2.4.2] - 2023-04-06
252 - Add `full` event to dynamic pool.
253 - Keep worker choice strategy in memory for conditional reuse.
257 - Fix possible negative worker key at worker removal in worker choice strategies.
259 ## [2.4.1] - 2023-04-05
263 - Optimize worker choice strategy for dynamic pool.
267 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
269 ## [2.4.0] - 2023-04-04
273 - Add `LESS_BUSY` worker choice strategy.
277 - Optimize worker storage in pool.
278 - Optimize worker alive status check.
279 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
280 - Optimize `LESS_USED` worker choice strategy.
281 - Update benchmarks versus external threads pools.
282 - Optimize tasks usage statistics requirements for 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.
289 - Fix package publication with pnpm.
291 ## [2.4.0-3] - 2023-04-04
295 - Add `LESS_BUSY` worker choice strategy.
299 - Optimize worker storage in pool.
300 - Optimize worker alive status check.
301 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
302 - Optimize `LESS_USED` worker choice strategy.
303 - Update benchmarks versus external threads pools.
307 - Ensure trimmable characters are checked at pool initialization.
308 - Fix message id integer overflow.
309 - Fix pool worker removal in worker choice strategy internals.
310 - Fix package publication with pnpm.
312 ## [2.4.0-2] - 2023-04-03
316 - Add `LESS_BUSY` worker choice strategy.
320 - Optimize worker storage in pool.
321 - Optimize worker alive status check.
322 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
323 - Optimize `LESS_USED` worker choice strategy.
327 - Ensure trimmable characters are checked at pool initialization.
328 - Fix message id integer overflow.
329 - Fix pool worker removal in worker choice strategy internals.
330 - Fix package publication with pnpm.
332 ## [2.4.0-1] - 2023-04-03
336 - Add `LESS_BUSY` worker choice strategy.
340 - Optimize worker storage in pool.
341 - Optimize worker alive status check.
342 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
343 - Optimize `LESS_USED` worker choice strategy.
347 - Ensure trimmable characters are checked at pool initialization.
348 - Fix message id integer overflow.
349 - Fix pool worker removal in worker choice strategy internals.
351 ## [2.4.0-0] - 2023-04-03
355 - Add `LESS_BUSY` worker choice strategy.
359 - Optimize worker storage in pool.
360 - Optimize worker alive status check.
361 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
362 - Optimize `LESS_USED` worker choice strategy.
366 - Ensure trimmable characters are checked at pool initialization.
367 - Fix message id integer overflow.
368 - Fix pool worker removal in worker choice strategy internals.
370 ## [2.3.10] - 2023-03-18
374 - Fix `exports` syntax for ESM and CommonJS.
378 - Permit SemVer pre-release publication.
380 ## [2.3.10-2] - 2023-03-18
384 - Fix `exports` syntax for ESM and CommonJS.
386 ## [2.3.10-1] - 2023-03-18
390 - Permit SemVer pre-release publication.
392 ## [2.3.10-0] - 2023-03-18
396 - Fix `exports` syntax for ESM and CommonJS.
398 ## [2.3.9] - 2023-03-18
402 - Introduce ESM module support along with CommonJS one.
406 - Fix brown paper bag bug referencing the same object literal.
408 ## [2.3.8] - 2023-03-18
412 - Switch internal benchmarking code to benny.
413 - Switch to TypeScript 5.x.x.
414 - Switch rollup bundler plugins to core ones.
415 - Switch to TSDoc syntax.
416 - Enforce conventional commits.
420 - Fix random integer generator.
421 - Fix worker choice strategy pool type identification at initialization.
423 ## [2.3.7] - 2022-10-23
427 - Switch to open collective FOSS project funding platform.
428 - Switch to ts-standard linter configuration on TypeScript code.
432 - Fixed missing async on pool execute method.
433 - Fixed typing in TypeScript example.
434 - Fixed types in unit tests.
436 ## [2.3.6] - 2022-10-22
440 - Cleanup pool attributes and methods.
441 - Refine error types thrown.
445 - Fix continuous integration build on windows.
446 - Fix code coverage reporting by using c8 instead of nyc.
448 ## [2.3.5] - 2022-10-21
452 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
453 - Optimize tasks usage lookup implementation.
457 - Fix missed pool event emitter type export.
458 - Fix typedoc documentation generation.
460 ## [2.3.4] - 2022-10-17
464 - Fully automate release process with release-it.
468 - Optimize fair share task scheduling algorithm implementation.
469 - Update benchmarks versus external pools results with latest version.
471 ## [2.3.3] - 2022-10-15
475 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
477 ## [2.3.2] - 2022-10-14
481 - Optimize fair share worker selection strategy implementation.
485 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
487 ## [2.3.1] - 2022-10-13
491 - Pool worker choice strategies:
492 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
493 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
495 ## [2.2.2] - 2022-10-09
499 - Fixed `README.md` file.
501 ## [2.2.1] - 2022-10-08
505 - Dynamic worker choice strategy change at runtime.
507 ## [2.2.0] - 2022-01-05
511 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
513 ## [2.1.0] - 2021-08-29
517 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
521 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
522 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
523 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
524 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
526 ## [2.0.2] - 2021-05-12
530 - Fix `busy` event emission on fixed pool type
532 ## [2.0.1] - 2021-03-16
536 - Check if pool options are properly set.
537 - `busy` event is emitted on all pool types.
539 ## [2.0.0] - 2021-03-01
543 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
547 - `FullPool` event is now renamed to `busy`.
548 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
549 _Find more details on our JSDoc._
551 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
553 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
555 ### Pool options types declaration merge
557 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
559 #### New `export` strategy
563 const DynamicThreadPool = require('poolifier/lib/dynamic')
565 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
568 But you should always prefer just using
571 const { DynamicThreadPool } = require('poolifier')
574 #### New type definitions for input data and response
576 For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data.
577 _This is not a limitation by poolifier but NodeJS._
579 #### Public property replacements
581 `numWorkers` property is now `numberOfWorkers`
583 #### Internal (protected) properties and methods renaming
585 These properties are not intended for end users
587 - `id` => `nextMessageId`
589 These methods are not intended for end users
591 - `_chooseWorker` => `chooseWorker`
592 - `_newWorker` => `createWorker`
593 - `_execute` => `internalExecute`
594 - `_chooseWorker` => `chooseWorker`
595 - `_checkAlive` => `checkAlive`
597 - `_runAsync` => `runAsync`
599 ## [1.1.0] - 2020-05-21
603 - ThreadWorker support async functions as option
604 - Various external library patches
606 ## [1.0.0] - 2020-01-24
610 - FixedThreadPool implementation
611 - DynamicThreadPool implementation
612 - WorkerThread implementation to improve developer experience