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 - Support multiple task functions per worker.
14 ## [2.4.11] - 2023-04-23
18 - Optimize free worker finding in worker choice strategies.
20 ## [2.4.10] - 2023-04-15
24 - Fix typescript type definition for worker function: ensure the input data is optional.
25 - Fix typescript type definition for pool execute(): ensure the input data is optional.
27 ## [2.4.9] - 2023-04-15
31 - Add tasks queue enablement runtime setter to pool.
32 - Add tasks queue options runtime setter to pool.
33 - Add worker choice strategy options runtime setter to pool.
37 - Remove the tasks queuing experimental status.
41 - Fix worker function type definition and validation.
42 - Fix worker choice strategy options handling.
44 ## [2.4.8] - 2023-04-12
48 - Fix message between main worker and worker type definition for tasks.
49 - Fix code documentation.
51 ## [2.4.7] - 2023-04-11
55 - Add worker tasks queue options to pool options.
59 - Fix missing documentation.
61 ## [2.4.6] - 2023-04-10
65 - Ensure one task at a time is executed per worker with tasks queueing enabled.
66 - Properly count worker running tasks with tasks queueing enabled.
68 ## [2.4.5] - 2023-04-09
72 - Use monotonic high resolution timer for worker tasks run time.
73 - Add worker tasks median run time to statistics.
74 - Add worker tasks queue (experimental).
76 ## [2.4.4] - 2023-04-07
80 - Add `PoolEvents` enumeration and `PoolEvent` type.
84 - Destroy worker only on alive check.
86 ## [2.4.3] - 2023-04-07
90 - Fix typedoc generation with inheritance.
92 ## [2.4.2] - 2023-04-06
96 - Add `full` event to dynamic pool.
97 - Keep worker choice strategy in memory for conditional reuse.
101 - Fix possible negative worker key at worker removal in worker choice strategies.
103 ## [2.4.1] - 2023-04-05
107 - Optimize worker choice strategy for dynamic pool.
111 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
113 ## [2.4.0] - 2023-04-04
117 - Add `LESS_BUSY` worker choice strategy.
121 - Optimize worker storage in pool.
122 - Optimize worker alive status check.
123 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
124 - Optimize `LESS_USED` worker choice strategy.
125 - Update benchmarks versus external threads pools.
126 - Optimize tasks usage statistics requirements for worker choice strategy.
130 - Ensure trimmable characters are checked at pool initialization.
131 - Fix message id integer overflow.
132 - Fix pool worker removal in worker choice strategy internals.
133 - Fix package publication with pnpm.
135 ## [2.4.0-3] - 2023-04-04
139 - Add `LESS_BUSY` worker choice strategy.
143 - Optimize worker storage in pool.
144 - Optimize worker alive status check.
145 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
146 - Optimize `LESS_USED` worker choice strategy.
147 - Update benchmarks versus external threads pools.
151 - Ensure trimmable characters are checked at pool initialization.
152 - Fix message id integer overflow.
153 - Fix pool worker removal in worker choice strategy internals.
154 - Fix package publication with pnpm.
156 ## [2.4.0-2] - 2023-04-03
160 - Add `LESS_BUSY` worker choice strategy.
164 - Optimize worker storage in pool.
165 - Optimize worker alive status check.
166 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
167 - Optimize `LESS_USED` worker choice strategy.
171 - Ensure trimmable characters are checked at pool initialization.
172 - Fix message id integer overflow.
173 - Fix pool worker removal in worker choice strategy internals.
174 - Fix package publication with pnpm.
176 ## [2.4.0-1] - 2023-04-03
180 - Add `LESS_BUSY` worker choice strategy.
184 - Optimize worker storage in pool.
185 - Optimize worker alive status check.
186 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
187 - Optimize `LESS_USED` worker choice strategy.
191 - Ensure trimmable characters are checked at pool initialization.
192 - Fix message id integer overflow.
193 - Fix pool worker removal in worker choice strategy internals.
195 ## [2.4.0-0] - 2023-04-03
199 - Add `LESS_BUSY` worker choice strategy.
203 - Optimize worker storage in pool.
204 - Optimize worker alive status check.
205 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
206 - Optimize `LESS_USED` worker choice strategy.
210 - Ensure trimmable characters are checked at pool initialization.
211 - Fix message id integer overflow.
212 - Fix pool worker removal in worker choice strategy internals.
214 ## [2.3.10] - 2023-03-18
218 - Fix `exports` syntax for ESM and CommonJS.
222 - Permit SemVer pre-release publication.
224 ## [2.3.10-2] - 2023-03-18
228 - Fix `exports` syntax for ESM and CommonJS.
230 ## [2.3.10-1] - 2023-03-18
234 - Permit SemVer pre-release publication.
236 ## [2.3.10-0] - 2023-03-18
240 - Fix `exports` syntax for ESM and CommonJS.
242 ## [2.3.9] - 2023-03-18
246 - Introduce ESM module support along with CommonJS one.
250 - Fix brown paper bag bug referencing the same object literal.
252 ## [2.3.8] - 2023-03-18
256 - Switch internal benchmarking code to benny.
257 - Switch to TypeScript 5.x.x.
258 - Switch rollup bundler plugins to core ones.
259 - Switch to TSDoc syntax.
260 - Enforce conventional commits.
264 - Fix random integer generator.
265 - Fix worker choice strategy pool type identification at initialization.
267 ## [2.3.7] - 2022-10-23
271 - Switch to open collective FOSS project funding platform.
272 - Switch to ts-standard linter configuration on TypeScript code.
276 - Fixed missing async on pool execute method.
277 - Fixed typing in TypeScript example.
278 - Fixed types in unit tests.
280 ## [2.3.6] - 2022-10-22
284 - Cleanup pool attributes and methods.
285 - Refine error types thrown.
289 - Fix continuous integration build on windows.
290 - Fix code coverage reporting by using c8 instead of nyc.
292 ## [2.3.5] - 2022-10-21
296 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
297 - Optimize tasks usage lookup implementation.
301 - Fix missed pool event emitter type export.
302 - Fix typedoc documentation generation.
304 ## [2.3.4] - 2022-10-17
308 - Fully automate release process with release-it.
312 - Optimize fair share task scheduling algorithm implementation.
313 - Update benchmarks versus external pools results with latest version.
315 ## [2.3.3] - 2022-10-15
319 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
321 ## [2.3.2] - 2022-10-14
325 - Optimize fair share worker selection strategy implementation.
329 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
331 ## [2.3.1] - 2022-10-13
335 - Pool worker choice strategies:
336 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
337 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
339 ## [2.2.2] - 2022-10-09
343 - Fixed `README.md` file.
345 ## [2.2.1] - 2022-10-08
349 - Dynamic worker choice strategy change at runtime.
351 ## [2.2.0] - 2022-01-05
355 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
357 ## [2.1.0] - 2021-08-29
361 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
365 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
366 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
367 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
368 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
370 ## [2.0.2] - 2021-05-12
374 - Fix `busy` event emission on fixed pool type
376 ## [2.0.1] - 2021-03-16
380 - Check if pool options are properly set.
381 - `busy` event is emitted on all pool types.
383 ## [2.0.0] - 2021-03-01
387 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
391 - `FullPool` event is now renamed to `busy`.
392 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
393 _Find more details on our JSDoc._
395 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
397 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
399 ### Pool options types declaration merge
401 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
403 #### New `export` strategy
407 const DynamicThreadPool = require('poolifier/lib/dynamic')
409 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
412 But you should always prefer just using
415 const { DynamicThreadPool } = require('poolifier')
418 #### New type definitions for input data and response
420 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
421 _This is not a limitation by poolifier but NodeJS._
423 #### Public property replacements
425 `numWorkers` property is now `numberOfWorkers`
427 #### Internal (protected) properties and methods renaming
429 These properties are not intended for end users
431 - `id` => `nextMessageId`
433 These methods are not intended for end users
435 - `_chooseWorker` => `chooseWorker`
436 - `_newWorker` => `createWorker`
437 - `_execute` => `internalExecute`
438 - `_chooseWorker` => `chooseWorker`
439 - `_checkAlive` => `checkAlive`
441 - `_runAsync` => `runAsync`
443 ## [1.1.0] - 2020-05-21
447 - ThreadWorker support async functions as option
448 - Various external library patches
450 ## [1.0.0] - 2020-01-24
454 - FixedThreadPool implementation
455 - DynamicThreadPool implementation
456 - WorkerThread implementation to improve developer experience