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 - Ensure no undefined task runtime can land in the tasks history.
13 - Fix median computation implementation once again.
15 ## [2.4.13] - 2023-05-08
19 - Fix worker choice strategy options validation.
20 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
22 ## [2.4.12] - 2023-05-06
26 - Support multiple task functions per worker.
27 - Add custom worker weights support to worker choice strategies options.
31 - Use O(1) queue implementation for tasks queueing.
35 - Fix median computation implementation.
36 - Fix fair share worker choice strategy internals update.
38 ## [2.4.11] - 2023-04-23
42 - Optimize free worker finding in worker choice strategies.
44 ## [2.4.10] - 2023-04-15
48 - Fix typescript type definition for worker function: ensure the input data is optional.
49 - Fix typescript type definition for pool execute(): ensure the input data is optional.
51 ## [2.4.9] - 2023-04-15
55 - Add tasks queue enablement runtime setter to pool.
56 - Add tasks queue options runtime setter to pool.
57 - Add worker choice strategy options runtime setter to pool.
61 - Remove the tasks queuing experimental status.
65 - Fix worker function type definition and validation.
66 - Fix worker choice strategy options handling.
68 ## [2.4.8] - 2023-04-12
72 - Fix message between main worker and worker type definition for tasks.
73 - Fix code documentation.
75 ## [2.4.7] - 2023-04-11
79 - Add worker tasks queue options to pool options.
83 - Fix missing documentation.
85 ## [2.4.6] - 2023-04-10
89 - Ensure one task at a time is executed per worker with tasks queueing enabled.
90 - Properly count worker running tasks with tasks queueing enabled.
92 ## [2.4.5] - 2023-04-09
96 - Use monotonic high resolution timer for worker tasks run time.
97 - Add worker tasks median run time to statistics.
98 - Add worker tasks queue (experimental).
100 ## [2.4.4] - 2023-04-07
104 - Add `PoolEvents` enumeration and `PoolEvent` type.
108 - Destroy worker only on alive check.
110 ## [2.4.3] - 2023-04-07
114 - Fix typedoc generation with inheritance.
116 ## [2.4.2] - 2023-04-06
120 - Add `full` event to dynamic pool.
121 - Keep worker choice strategy in memory for conditional reuse.
125 - Fix possible negative worker key at worker removal in worker choice strategies.
127 ## [2.4.1] - 2023-04-05
131 - Optimize worker choice strategy for dynamic pool.
135 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
137 ## [2.4.0] - 2023-04-04
141 - Add `LESS_BUSY` worker choice strategy.
145 - Optimize worker storage in pool.
146 - Optimize worker alive status check.
147 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
148 - Optimize `LESS_USED` worker choice strategy.
149 - Update benchmarks versus external threads pools.
150 - Optimize tasks usage statistics requirements for worker choice strategy.
154 - Ensure trimmable characters are checked at pool initialization.
155 - Fix message id integer overflow.
156 - Fix pool worker removal in worker choice strategy internals.
157 - Fix package publication with pnpm.
159 ## [2.4.0-3] - 2023-04-04
163 - Add `LESS_BUSY` worker choice strategy.
167 - Optimize worker storage in pool.
168 - Optimize worker alive status check.
169 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
170 - Optimize `LESS_USED` worker choice strategy.
171 - Update benchmarks versus external threads pools.
175 - Ensure trimmable characters are checked at pool initialization.
176 - Fix message id integer overflow.
177 - Fix pool worker removal in worker choice strategy internals.
178 - Fix package publication with pnpm.
180 ## [2.4.0-2] - 2023-04-03
184 - Add `LESS_BUSY` worker choice strategy.
188 - Optimize worker storage in pool.
189 - Optimize worker alive status check.
190 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
191 - Optimize `LESS_USED` worker choice strategy.
195 - Ensure trimmable characters are checked at pool initialization.
196 - Fix message id integer overflow.
197 - Fix pool worker removal in worker choice strategy internals.
198 - Fix package publication with pnpm.
200 ## [2.4.0-1] - 2023-04-03
204 - Add `LESS_BUSY` worker choice strategy.
208 - Optimize worker storage in pool.
209 - Optimize worker alive status check.
210 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
211 - Optimize `LESS_USED` worker choice strategy.
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.
219 ## [2.4.0-0] - 2023-04-03
223 - Add `LESS_BUSY` worker choice strategy.
227 - Optimize worker storage in pool.
228 - Optimize worker alive status check.
229 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
230 - Optimize `LESS_USED` worker choice strategy.
234 - Ensure trimmable characters are checked at pool initialization.
235 - Fix message id integer overflow.
236 - Fix pool worker removal in worker choice strategy internals.
238 ## [2.3.10] - 2023-03-18
242 - Fix `exports` syntax for ESM and CommonJS.
246 - Permit SemVer pre-release publication.
248 ## [2.3.10-2] - 2023-03-18
252 - Fix `exports` syntax for ESM and CommonJS.
254 ## [2.3.10-1] - 2023-03-18
258 - Permit SemVer pre-release publication.
260 ## [2.3.10-0] - 2023-03-18
264 - Fix `exports` syntax for ESM and CommonJS.
266 ## [2.3.9] - 2023-03-18
270 - Introduce ESM module support along with CommonJS one.
274 - Fix brown paper bag bug referencing the same object literal.
276 ## [2.3.8] - 2023-03-18
280 - Switch internal benchmarking code to benny.
281 - Switch to TypeScript 5.x.x.
282 - Switch rollup bundler plugins to core ones.
283 - Switch to TSDoc syntax.
284 - Enforce conventional commits.
288 - Fix random integer generator.
289 - Fix worker choice strategy pool type identification at initialization.
291 ## [2.3.7] - 2022-10-23
295 - Switch to open collective FOSS project funding platform.
296 - Switch to ts-standard linter configuration on TypeScript code.
300 - Fixed missing async on pool execute method.
301 - Fixed typing in TypeScript example.
302 - Fixed types in unit tests.
304 ## [2.3.6] - 2022-10-22
308 - Cleanup pool attributes and methods.
309 - Refine error types thrown.
313 - Fix continuous integration build on windows.
314 - Fix code coverage reporting by using c8 instead of nyc.
316 ## [2.3.5] - 2022-10-21
320 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
321 - Optimize tasks usage lookup implementation.
325 - Fix missed pool event emitter type export.
326 - Fix typedoc documentation generation.
328 ## [2.3.4] - 2022-10-17
332 - Fully automate release process with release-it.
336 - Optimize fair share task scheduling algorithm implementation.
337 - Update benchmarks versus external pools results with latest version.
339 ## [2.3.3] - 2022-10-15
343 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
345 ## [2.3.2] - 2022-10-14
349 - Optimize fair share worker selection strategy implementation.
353 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
355 ## [2.3.1] - 2022-10-13
359 - Pool worker choice strategies:
360 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
361 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
363 ## [2.2.2] - 2022-10-09
367 - Fixed `README.md` file.
369 ## [2.2.1] - 2022-10-08
373 - Dynamic worker choice strategy change at runtime.
375 ## [2.2.0] - 2022-01-05
379 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
381 ## [2.1.0] - 2021-08-29
385 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
389 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
390 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
391 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
392 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
394 ## [2.0.2] - 2021-05-12
398 - Fix `busy` event emission on fixed pool type
400 ## [2.0.1] - 2021-03-16
404 - Check if pool options are properly set.
405 - `busy` event is emitted on all pool types.
407 ## [2.0.0] - 2021-03-01
411 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
415 - `FullPool` event is now renamed to `busy`.
416 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
417 _Find more details on our JSDoc._
419 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
421 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
423 ### Pool options types declaration merge
425 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
427 #### New `export` strategy
431 const DynamicThreadPool = require('poolifier/lib/dynamic')
433 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
436 But you should always prefer just using
439 const { DynamicThreadPool } = require('poolifier')
442 #### New type definitions for input data and response
444 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
445 _This is not a limitation by poolifier but NodeJS._
447 #### Public property replacements
449 `numWorkers` property is now `numberOfWorkers`
451 #### Internal (protected) properties and methods renaming
453 These properties are not intended for end users
455 - `id` => `nextMessageId`
457 These methods are not intended for end users
459 - `_chooseWorker` => `chooseWorker`
460 - `_newWorker` => `createWorker`
461 - `_execute` => `internalExecute`
462 - `_chooseWorker` => `chooseWorker`
463 - `_checkAlive` => `checkAlive`
465 - `_runAsync` => `runAsync`
467 ## [1.1.0] - 2020-05-21
471 - ThreadWorker support async functions as option
472 - Various external library patches
474 ## [1.0.0] - 2020-01-24
478 - FixedThreadPool implementation
479 - DynamicThreadPool implementation
480 - WorkerThread implementation to improve developer experience