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.5.3] - 2023-06-04
14 - Refine pool information content.
15 - Limit pool internals public exposure.
17 ## [2.5.2] - 2023-06-02
21 - Add `taskError` pool event for task execution error.
22 - Add pool information `info` property to pool.
23 - Emit pool information on `busy` and `full` pool events.
25 ## [2.5.1] - 2023-06-01
29 - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
30 - Add `error` pool event for uncaught worker error.
32 ## [2.5.0] - 2023-05-31
36 - Switch pool event emitter to `EventEmitterAsyncResource`.
37 - Add tasks wait time accounting in per worker tasks usage.
38 - Add interleaved weighted round robin worker choice strategy (experimental).
42 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
44 ## [2.4.14] - 2023-05-09
48 - Ensure no undefined task runtime can land in the tasks history.
49 - Fix median computation implementation once again.
53 - Unit tests for median and queue implementations.
55 ## [2.4.13] - 2023-05-08
59 - Fix worker choice strategy options validation.
60 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
62 ## [2.4.12] - 2023-05-06
66 - Support multiple task functions per worker.
67 - Add custom worker weights support to worker choice strategies options.
71 - Use O(1) queue implementation for tasks queueing.
75 - Fix median computation implementation.
76 - Fix fair share worker choice strategy internals update.
78 ## [2.4.11] - 2023-04-23
82 - Optimize free worker finding in worker choice strategies.
84 ## [2.4.10] - 2023-04-15
88 - Fix typescript type definition for worker function: ensure the input data is optional.
89 - Fix typescript type definition for pool execute(): ensure the input data is optional.
91 ## [2.4.9] - 2023-04-15
95 - Add tasks queue enablement runtime setter to pool.
96 - Add tasks queue options runtime setter to pool.
97 - Add worker choice strategy options runtime setter to pool.
101 - Remove the tasks queuing experimental status.
105 - Fix worker function type definition and validation.
106 - Fix worker choice strategy options handling.
108 ## [2.4.8] - 2023-04-12
112 - Fix message between main worker and worker type definition for tasks.
113 - Fix code documentation.
115 ## [2.4.7] - 2023-04-11
119 - Add worker tasks queue options to pool options.
123 - Fix missing documentation.
125 ## [2.4.6] - 2023-04-10
129 - Ensure one task at a time is executed per worker with tasks queueing enabled.
130 - Properly count worker running tasks with tasks queueing enabled.
132 ## [2.4.5] - 2023-04-09
136 - Use monotonic high resolution timer for worker tasks runtime.
137 - Add worker tasks median runtime to statistics.
138 - Add worker tasks queue (experimental).
140 ## [2.4.4] - 2023-04-07
144 - Add `PoolEvents` enumeration and `PoolEvent` type.
148 - Destroy worker only on alive check.
150 ## [2.4.3] - 2023-04-07
154 - Fix typedoc generation with inheritance.
156 ## [2.4.2] - 2023-04-06
160 - Add `full` event to dynamic pool.
161 - Keep worker choice strategy in memory for conditional reuse.
165 - Fix possible negative worker key at worker removal in worker choice strategies.
167 ## [2.4.1] - 2023-04-05
171 - Optimize worker choice strategy for dynamic pool.
175 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
177 ## [2.4.0] - 2023-04-04
181 - Add `LESS_BUSY` worker choice strategy.
185 - Optimize worker storage in pool.
186 - Optimize worker alive status check.
187 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
188 - Optimize `LESS_USED` worker choice strategy.
189 - Update benchmarks versus external threads pools.
190 - Optimize tasks usage statistics requirements for worker choice strategy.
194 - Ensure trimmable characters are checked at pool initialization.
195 - Fix message id integer overflow.
196 - Fix pool worker removal in worker choice strategy internals.
197 - Fix package publication with pnpm.
199 ## [2.4.0-3] - 2023-04-04
203 - Add `LESS_BUSY` worker choice strategy.
207 - Optimize worker storage in pool.
208 - Optimize worker alive status check.
209 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
210 - Optimize `LESS_USED` worker choice strategy.
211 - Update benchmarks versus external threads pools.
215 - Ensure trimmable characters are checked at pool initialization.
216 - Fix message id integer overflow.
217 - Fix pool worker removal in worker choice strategy internals.
218 - Fix package publication with pnpm.
220 ## [2.4.0-2] - 2023-04-03
224 - Add `LESS_BUSY` worker choice strategy.
228 - Optimize worker storage in pool.
229 - Optimize worker alive status check.
230 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
231 - Optimize `LESS_USED` worker choice strategy.
235 - Ensure trimmable characters are checked at pool initialization.
236 - Fix message id integer overflow.
237 - Fix pool worker removal in worker choice strategy internals.
238 - Fix package publication with pnpm.
240 ## [2.4.0-1] - 2023-04-03
244 - Add `LESS_BUSY` worker choice strategy.
248 - Optimize worker storage in pool.
249 - Optimize worker alive status check.
250 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
251 - Optimize `LESS_USED` worker choice strategy.
255 - Ensure trimmable characters are checked at pool initialization.
256 - Fix message id integer overflow.
257 - Fix pool worker removal in worker choice strategy internals.
259 ## [2.4.0-0] - 2023-04-03
263 - Add `LESS_BUSY` worker choice strategy.
267 - Optimize worker storage in pool.
268 - Optimize worker alive status check.
269 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
270 - Optimize `LESS_USED` worker choice strategy.
274 - Ensure trimmable characters are checked at pool initialization.
275 - Fix message id integer overflow.
276 - Fix pool worker removal in worker choice strategy internals.
278 ## [2.3.10] - 2023-03-18
282 - Fix `exports` syntax for ESM and CommonJS.
286 - Permit SemVer pre-release publication.
288 ## [2.3.10-2] - 2023-03-18
292 - Fix `exports` syntax for ESM and CommonJS.
294 ## [2.3.10-1] - 2023-03-18
298 - Permit SemVer pre-release publication.
300 ## [2.3.10-0] - 2023-03-18
304 - Fix `exports` syntax for ESM and CommonJS.
306 ## [2.3.9] - 2023-03-18
310 - Introduce ESM module support along with CommonJS one.
314 - Fix brown paper bag bug referencing the same object literal.
316 ## [2.3.8] - 2023-03-18
320 - Switch internal benchmarking code to benny.
321 - Switch to TypeScript 5.x.x.
322 - Switch rollup bundler plugins to core ones.
323 - Switch to TSDoc syntax.
324 - Enforce conventional commits.
328 - Fix random integer generator.
329 - Fix worker choice strategy pool type identification at initialization.
331 ## [2.3.7] - 2022-10-23
335 - Switch to open collective FOSS project funding platform.
336 - Switch to ts-standard linter configuration on TypeScript code.
340 - Fixed missing async on pool execute method.
341 - Fixed typing in TypeScript example.
342 - Fixed types in unit tests.
344 ## [2.3.6] - 2022-10-22
348 - Cleanup pool attributes and methods.
349 - Refine error types thrown.
353 - Fix continuous integration build on windows.
354 - Fix code coverage reporting by using c8 instead of nyc.
356 ## [2.3.5] - 2022-10-21
360 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
361 - Optimize tasks usage lookup implementation.
365 - Fix missed pool event emitter type export.
366 - Fix typedoc documentation generation.
368 ## [2.3.4] - 2022-10-17
372 - Fully automate release process with release-it.
376 - Optimize fair share task scheduling algorithm implementation.
377 - Update benchmarks versus external pools results with latest version.
379 ## [2.3.3] - 2022-10-15
383 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
385 ## [2.3.2] - 2022-10-14
389 - Optimize fair share worker selection strategy implementation.
393 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
395 ## [2.3.1] - 2022-10-13
399 - Pool worker choice strategies:
400 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
401 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
403 ## [2.2.2] - 2022-10-09
407 - Fixed `README.md` file.
409 ## [2.2.1] - 2022-10-08
413 - Dynamic worker choice strategy change at runtime.
415 ## [2.2.0] - 2022-01-05
419 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
421 ## [2.1.0] - 2021-08-29
425 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
429 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
430 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
431 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
432 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
434 ## [2.0.2] - 2021-05-12
438 - Fix `busy` event emission on fixed pool type
440 ## [2.0.1] - 2021-03-16
444 - Check if pool options are properly set.
445 - `busy` event is emitted on all pool types.
447 ## [2.0.0] - 2021-03-01
451 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
455 - `FullPool` event is now renamed to `busy`.
456 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
457 _Find more details on our JSDoc._
459 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
461 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
463 ### Pool options types declaration merge
465 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
467 #### New `export` strategy
471 const DynamicThreadPool = require('poolifier/lib/dynamic')
473 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
476 But you should always prefer just using
479 const { DynamicThreadPool } = require('poolifier')
482 #### New type definitions for input data and response
484 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
485 _This is not a limitation by poolifier but NodeJS._
487 #### Public property replacements
489 `numWorkers` property is now `numberOfWorkers`
491 #### Internal (protected) properties and methods renaming
493 These properties are not intended for end users
495 - `id` => `nextMessageId`
497 These methods are not intended for end users
499 - `_chooseWorker` => `chooseWorker`
500 - `_newWorker` => `createWorker`
501 - `_execute` => `internalExecute`
502 - `_chooseWorker` => `chooseWorker`
503 - `_checkAlive` => `checkAlive`
505 - `_runAsync` => `runAsync`
507 ## [1.1.0] - 2020-05-21
511 - ThreadWorker support async functions as option
512 - Various external library patches
514 ## [1.0.0] - 2020-01-24
518 - FixedThreadPool implementation
519 - DynamicThreadPool implementation
520 - WorkerThread implementation to improve developer experience