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.4.11] - 2023-04-23
14 - Optimize free worker finding in worker choice strategies.
16 ## [2.4.10] - 2023-04-15
20 - Fix typescript type definition for worker function: ensure the input data is optional.
21 - Fix typescript type definition for pool execute(): ensure the input data is optional.
23 ## [2.4.9] - 2023-04-15
27 - Add tasks queue enablement runtime setter to pool.
28 - Add tasks queue options runtime setter to pool.
29 - Add worker choice strategy options runtime setter to pool.
33 - Remove the tasks queuing experimental status.
37 - Fix worker function type definition and validation.
38 - Fix worker choice strategy options handling.
40 ## [2.4.8] - 2023-04-12
44 - Fix message between main worker and worker type definition for tasks.
45 - Fix code documentation.
47 ## [2.4.7] - 2023-04-11
51 - Add worker tasks queue options to pool options.
55 - Fix missing documentation.
57 ## [2.4.6] - 2023-04-10
61 - Ensure one task at a time is executed per worker with tasks queueing enabled.
62 - Properly count worker running tasks with tasks queueing enabled.
64 ## [2.4.5] - 2023-04-09
68 - Use monotonic high resolution timer for worker tasks run time.
69 - Add worker tasks median run time to statistics.
70 - Add worker tasks queue (experimental).
72 ## [2.4.4] - 2023-04-07
76 - Add `PoolEvents` enumeration and `PoolEvent` type.
80 - Destroy worker only on alive check.
82 ## [2.4.3] - 2023-04-07
86 - Fix typedoc generation with inheritance.
88 ## [2.4.2] - 2023-04-06
92 - Add `full` event to dynamic pool.
93 - Keep worker choice strategy in memory for conditional reuse.
97 - Fix possible negative worker key at worker removal in worker choice strategies.
99 ## [2.4.1] - 2023-04-05
103 - Optimize worker choice strategy for dynamic pool.
107 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
109 ## [2.4.0] - 2023-04-04
113 - Add `LESS_BUSY` worker choice strategy.
117 - Optimize worker storage in pool.
118 - Optimize worker alive status check.
119 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
120 - Optimize `LESS_USED` worker choice strategy.
121 - Update benchmarks versus external threads pools.
122 - Optimize tasks usage statistics requirements for worker choice strategy.
126 - Ensure trimmable characters are checked at pool initialization.
127 - Fix message id integer overflow.
128 - Fix pool worker removal in worker choice strategy internals.
129 - Fix package publication with pnpm.
131 ## [2.4.0-3] - 2023-04-04
135 - Add `LESS_BUSY` worker choice strategy.
139 - Optimize worker storage in pool.
140 - Optimize worker alive status check.
141 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
142 - Optimize `LESS_USED` worker choice strategy.
143 - Update benchmarks versus external threads pools.
147 - Ensure trimmable characters are checked at pool initialization.
148 - Fix message id integer overflow.
149 - Fix pool worker removal in worker choice strategy internals.
150 - Fix package publication with pnpm.
152 ## [2.4.0-2] - 2023-04-03
156 - Add `LESS_BUSY` worker choice strategy.
160 - Optimize worker storage in pool.
161 - Optimize worker alive status check.
162 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
163 - Optimize `LESS_USED` worker choice strategy.
167 - Ensure trimmable characters are checked at pool initialization.
168 - Fix message id integer overflow.
169 - Fix pool worker removal in worker choice strategy internals.
170 - Fix package publication with pnpm.
172 ## [2.4.0-1] - 2023-04-03
176 - Add `LESS_BUSY` worker choice strategy.
180 - Optimize worker storage in pool.
181 - Optimize worker alive status check.
182 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
183 - Optimize `LESS_USED` worker choice strategy.
187 - Ensure trimmable characters are checked at pool initialization.
188 - Fix message id integer overflow.
189 - Fix pool worker removal in worker choice strategy internals.
191 ## [2.4.0-0] - 2023-04-03
195 - Add `LESS_BUSY` worker choice strategy.
199 - Optimize worker storage in pool.
200 - Optimize worker alive status check.
201 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
202 - Optimize `LESS_USED` 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.
210 ## [2.3.10] - 2023-03-18
214 - Fix `exports` syntax for ESM and CommonJS.
218 - Permit SemVer pre-release publication.
220 ## [2.3.10-2] - 2023-03-18
224 - Fix `exports` syntax for ESM and CommonJS.
226 ## [2.3.10-1] - 2023-03-18
230 - Permit SemVer pre-release publication.
232 ## [2.3.10-0] - 2023-03-18
236 - Fix `exports` syntax for ESM and CommonJS.
238 ## [2.3.9] - 2023-03-18
242 - Introduce ESM module support along with CommonJS one.
246 - Fix brown paper bag bug referencing the same object literal.
248 ## [2.3.8] - 2023-03-18
252 - Switch internal benchmarking code to benny.
253 - Switch to TypeScript 5.x.x.
254 - Switch rollup bundler plugins to core ones.
255 - Switch to TSDoc syntax.
256 - Enforce conventional commits.
260 - Fix random integer generator.
261 - Fix worker choice strategy pool type identification at initialization.
263 ## [2.3.7] - 2022-10-23
267 - Switch to open collective FOSS project funding platform.
268 - Switch to ts-standard linter configuration on TypeScript code.
272 - Fixed missing async on pool execute method.
273 - Fixed typing in TypeScript example.
274 - Fixed types in unit tests.
276 ## [2.3.6] - 2022-10-22
280 - Cleanup pool attributes and methods.
281 - Refine error types thrown.
285 - Fix continuous integration build on windows.
286 - Fix code coverage reporting by using c8 instead of nyc.
288 ## [2.3.5] - 2022-10-21
292 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
293 - Optimize tasks usage lookup implementation.
297 - Fix missed pool event emitter type export.
298 - Fix typedoc documentation generation.
300 ## [2.3.4] - 2022-10-17
304 - Fully automate release process with release-it.
308 - Optimize fair share task scheduling algorithm implementation.
309 - Update benchmarks versus external pools results with latest version.
311 ## [2.3.3] - 2022-10-15
315 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
317 ## [2.3.2] - 2022-10-14
321 - Optimize fair share worker selection strategy implementation.
325 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
327 ## [2.3.1] - 2022-10-13
331 - Pool worker choice strategies:
332 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
333 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
335 ## [2.2.2] - 2022-10-09
339 - Fixed `README.md` file.
341 ## [2.2.1] - 2022-10-08
345 - Dynamic worker choice strategy change at runtime.
347 ## [2.2.0] - 2022-01-05
351 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
353 ## [2.1.0] - 2021-08-29
357 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
361 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
362 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
363 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
364 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
366 ## [2.0.2] - 2021-05-12
370 - Fix `busy` event emission on fixed pool type
372 ## [2.0.1] - 2021-03-16
376 - Check if pool options are properly set.
377 - `busy` event is emitted on all pool types.
379 ## [2.0.0] - 2021-03-01
383 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
387 - `FullPool` event is now renamed to `busy`.
388 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
389 _Find more details on our JSDoc._
391 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
393 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
395 ### Pool options types declaration merge
397 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
399 #### New `export` strategy
403 const DynamicThreadPool = require('poolifier/lib/dynamic')
405 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
408 But you should always prefer just using
411 const { DynamicThreadPool } = require('poolifier')
414 #### New type definitions for input data and response
416 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
417 _This is not a limitation by poolifier but NodeJS._
419 #### Public property replacements
421 `numWorkers` property is now `numberOfWorkers`
423 #### Internal (protected) properties and methods renaming
425 These properties are not intended for end users
427 - `id` => `nextMessageId`
429 These methods are not intended for end users
431 - `_chooseWorker` => `chooseWorker`
432 - `_newWorker` => `createWorker`
433 - `_execute` => `internalExecute`
434 - `_chooseWorker` => `chooseWorker`
435 - `_checkAlive` => `checkAlive`
437 - `_runAsync` => `runAsync`
439 ## [1.1.0] - 2020-05-21
443 - ThreadWorker support async functions as option
444 - Various external library patches
446 ## [1.0.0] - 2020-01-24
450 - FixedThreadPool implementation
451 - DynamicThreadPool implementation
452 - WorkerThread implementation to improve developer experience