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.5] - 2023-04-09
14 - Use monotonic high resolution timer for worker tasks run time.
15 - Add worker tasks median run time to statistics.
16 - Add worker tasks queue (experimental).
18 ## [2.4.4] - 2023-04-07
22 - Add `PoolEvents` enumeration and `PoolEvent` type.
26 - Destroy worker only on alive check.
28 ## [2.4.3] - 2023-04-07
32 - Fix typedoc generation with inheritance.
34 ## [2.4.2] - 2023-04-06
38 - Add `full` event to dynamic pool.
39 - Keep worker choice strategy in memory for conditional reuse.
43 - Fix possible negative worker key at worker removal in worker choice strategies.
45 ## [2.4.1] - 2023-04-05
49 - Optimize worker choice strategy for dynamic pool.
53 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
55 ## [2.4.0] - 2023-04-04
59 - Add `LESS_BUSY` worker choice strategy.
63 - Optimize worker storage in pool.
64 - Optimize worker alive status check.
65 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
66 - Optimize `LESS_USED` worker choice strategy.
67 - Update benchmarks versus external threads pools.
68 - Optimize tasks usage statistics requirements for worker choice strategy.
72 - Ensure trimmable characters are checked at pool initialization.
73 - Fix message id integer overflow.
74 - Fix pool worker removal in worker choice strategy internals.
75 - Fix package publication with pnpm.
77 ## [2.4.0-3] - 2023-04-04
81 - Add `LESS_BUSY` worker choice strategy.
85 - Optimize worker storage in pool.
86 - Optimize worker alive status check.
87 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
88 - Optimize `LESS_USED` worker choice strategy.
89 - Update benchmarks versus external threads pools.
93 - Ensure trimmable characters are checked at pool initialization.
94 - Fix message id integer overflow.
95 - Fix pool worker removal in worker choice strategy internals.
96 - Fix package publication with pnpm.
98 ## [2.4.0-2] - 2023-04-03
102 - Add `LESS_BUSY` worker choice strategy.
106 - Optimize worker storage in pool.
107 - Optimize worker alive status check.
108 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
109 - Optimize `LESS_USED` worker choice strategy.
113 - Ensure trimmable characters are checked at pool initialization.
114 - Fix message id integer overflow.
115 - Fix pool worker removal in worker choice strategy internals.
116 - Fix package publication with pnpm.
118 ## [2.4.0-1] - 2023-04-03
122 - Add `LESS_BUSY` worker choice strategy.
126 - Optimize worker storage in pool.
127 - Optimize worker alive status check.
128 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
129 - Optimize `LESS_USED` worker choice strategy.
133 - Ensure trimmable characters are checked at pool initialization.
134 - Fix message id integer overflow.
135 - Fix pool worker removal in worker choice strategy internals.
137 ## [2.4.0-0] - 2023-04-03
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.
152 - Ensure trimmable characters are checked at pool initialization.
153 - Fix message id integer overflow.
154 - Fix pool worker removal in worker choice strategy internals.
156 ## [2.3.10] - 2023-03-18
160 - Fix `exports` syntax for ESM and CommonJS.
164 - Permit SemVer pre-release publication.
166 ## [2.3.10-2] - 2023-03-18
170 - Fix `exports` syntax for ESM and CommonJS.
172 ## [2.3.10-1] - 2023-03-18
176 - Permit SemVer pre-release publication.
178 ## [2.3.10-0] - 2023-03-18
182 - Fix `exports` syntax for ESM and CommonJS.
184 ## [2.3.9] - 2023-03-18
188 - Introduce ESM module support along with CommonJS one.
192 - Fix brown paper bag bug referencing the same object literal.
194 ## [2.3.8] - 2023-03-18
198 - Switch internal benchmarking code to benny.
199 - Switch to TypeScript 5.x.x.
200 - Switch rollup bundler plugins to core ones.
201 - Switch to TSDoc syntax.
202 - Enforce conventional commits.
206 - Fix random integer generator.
207 - Fix worker choice strategy pool type identification at initialization.
209 ## [2.3.7] - 2022-10-23
213 - Switch to open collective FOSS project funding platform.
214 - Switch to ts-standard linter configuration on TypeScript code.
218 - Fixed missing async on pool execute method.
219 - Fixed typing in TypeScript example.
220 - Fixed types in unit tests.
222 ## [2.3.6] - 2022-10-22
226 - Cleanup pool attributes and methods.
227 - Refine error types thrown.
231 - Fix continuous integration build on windows.
232 - Fix code coverage reporting by using c8 instead of nyc.
234 ## [2.3.5] - 2022-10-21
238 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
239 - Optimize tasks usage lookup implementation.
243 - Fix missed pool event emitter type export.
244 - Fix typedoc documentation generation.
246 ## [2.3.4] - 2022-10-17
250 - Fully automate release process with release-it.
254 - Optimize fair share task scheduling algorithm implementation.
255 - Update benchmarks versus external pools results with latest version.
257 ## [2.3.3] - 2022-10-15
261 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
263 ## [2.3.2] - 2022-10-14
267 - Optimize fair share worker selection strategy implementation.
271 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
273 ## [2.3.1] - 2022-10-13
277 - Pool worker choice strategies:
278 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
279 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
281 ## [2.2.2] - 2022-10-09
285 - Fixed `README.md` file.
287 ## [2.2.1] - 2022-10-08
291 - Dynamic worker choice strategy change at runtime.
293 ## [2.2.0] - 2022-01-05
297 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
299 ## [2.1.0] - 2021-08-29
303 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
307 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
308 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
309 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
310 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
312 ## [2.0.2] - 2021-05-12
316 - Fix `busy` event emission on fixed pool type
318 ## [2.0.1] - 2021-03-16
322 - Check if pool options are properly set.
323 - `busy` event is emitted on all pool types.
325 ## [2.0.0] - 2021-03-01
329 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
333 - `FullPool` event is now renamed to `busy`.
334 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
335 _Find more details on our JSDoc._
337 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
339 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
341 ### Pool options types declaration merge
343 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
345 #### New `export` strategy
349 const DynamicThreadPool = require('poolifier/lib/dynamic')
351 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
354 But you should always prefer just using
357 const { DynamicThreadPool } = require('poolifier')
360 #### New type definitions for input data and response
362 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
363 _This is not a limitation by poolifier but NodeJS._
365 #### Public property replacements
367 `numWorkers` property is now `numberOfWorkers`
369 #### Internal (protected) properties and methods renaming
371 These properties are not intended for end users
373 - `id` => `nextMessageId`
375 These methods are not intended for end users
377 - `_chooseWorker` => `chooseWorker`
378 - `_newWorker` => `createWorker`
379 - `_execute` => `internalExecute`
380 - `_chooseWorker` => `chooseWorker`
381 - `_checkAlive` => `checkAlive`
383 - `_runAsync` => `runAsync`
385 ## [1.1.0] - 2020-05-21
389 - ThreadWorker support async functions as option
390 - Various external library patches
392 ## [1.0.0] - 2020-01-24
396 - FixedThreadPool implementation
397 - DynamicThreadPool implementation
398 - WorkerThread implementation to improve developer experience