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 - Add `PoolEvents` enumeration and `PoolEvent` type.
16 - fix: destroy worker only on alive check.
18 ## [2.4.3] - 2023-04-07
22 - Fix typedoc generation with inheritance.
24 ## [2.4.2] - 2023-04-06
28 - Add `full` event to dynamic pool.
29 - Keep worker choice strategy in memory for conditional reuse.
33 - Fix possible negative worker key at worker removal in worker choice strategies.
35 ## [2.4.1] - 2023-04-05
39 - Optimize worker choice strategy for dynamic pool.
43 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
45 ## [2.4.0] - 2023-04-04
49 - Add `LESS_BUSY` worker choice strategy.
53 - Optimize worker storage in pool.
54 - Optimize worker alive status check.
55 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
56 - Optimize `LESS_USED` worker choice strategy.
57 - Update benchmarks versus external threads pools.
58 - Optimize tasks usage statistics requirements for worker choice strategy.
62 - Ensure trimmable characters are checked at pool initialization.
63 - Fix message id integer overflow.
64 - Fix pool worker removal in worker choice strategy internals.
65 - Fix package publication with pnpm.
67 ## [2.4.0-3] - 2023-04-04
71 - Add `LESS_BUSY` worker choice strategy.
75 - Optimize worker storage in pool.
76 - Optimize worker alive status check.
77 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
78 - Optimize `LESS_USED` worker choice strategy.
79 - Update benchmarks versus external threads pools.
83 - Ensure trimmable characters are checked at pool initialization.
84 - Fix message id integer overflow.
85 - Fix pool worker removal in worker choice strategy internals.
86 - Fix package publication with pnpm.
88 ## [2.4.0-2] - 2023-04-03
92 - Add `LESS_BUSY` worker choice strategy.
96 - Optimize worker storage in pool.
97 - Optimize worker alive status check.
98 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
99 - Optimize `LESS_USED` worker choice strategy.
103 - Ensure trimmable characters are checked at pool initialization.
104 - Fix message id integer overflow.
105 - Fix pool worker removal in worker choice strategy internals.
106 - Fix package publication with pnpm.
108 ## [2.4.0-1] - 2023-04-03
112 - Add `LESS_BUSY` worker choice strategy.
116 - Optimize worker storage in pool.
117 - Optimize worker alive status check.
118 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
119 - Optimize `LESS_USED` worker choice strategy.
123 - Ensure trimmable characters are checked at pool initialization.
124 - Fix message id integer overflow.
125 - Fix pool worker removal in worker choice strategy internals.
127 ## [2.4.0-0] - 2023-04-03
131 - Add `LESS_BUSY` worker choice strategy.
135 - Optimize worker storage in pool.
136 - Optimize worker alive status check.
137 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
138 - Optimize `LESS_USED` worker choice strategy.
142 - Ensure trimmable characters are checked at pool initialization.
143 - Fix message id integer overflow.
144 - Fix pool worker removal in worker choice strategy internals.
146 ## [2.3.10] - 2023-03-18
150 - Fix `exports` syntax for ESM and CommonJS.
154 - Permit SemVer pre-release publication.
156 ## [2.3.10-2] - 2023-03-18
160 - Fix `exports` syntax for ESM and CommonJS.
162 ## [2.3.10-1] - 2023-03-18
166 - Permit SemVer pre-release publication.
168 ## [2.3.10-0] - 2023-03-18
172 - Fix `exports` syntax for ESM and CommonJS.
174 ## [2.3.9] - 2023-03-18
178 - Introduce ESM module support along with CommonJS one.
182 - Fix brown paper bag bug referencing the same object literal.
184 ## [2.3.8] - 2023-03-18
188 - Switch internal benchmarking code to benny.
189 - Switch to TypeScript 5.x.x.
190 - Switch rollup bundler plugins to core ones.
191 - Switch to TSDoc syntax.
192 - Enforce conventional commits.
196 - Fix random integer generator.
197 - Fix worker choice strategy pool type identification at initialization.
199 ## [2.3.7] - 2022-10-23
203 - Switch to open collective FOSS project funding platform.
204 - Switch to ts-standard linter configuration on TypeScript code.
208 - Fixed missing async on pool execute method.
209 - Fixed typing in TypeScript example.
210 - Fixed types in unit tests.
212 ## [2.3.6] - 2022-10-22
216 - Cleanup pool attributes and methods.
217 - Refine error types thrown.
221 - Fix continuous integration build on windows.
222 - Fix code coverage reporting by using c8 instead of nyc.
224 ## [2.3.5] - 2022-10-21
228 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
229 - Optimize tasks usage lookup implementation.
233 - Fix missed pool event emitter type export.
234 - Fix typedoc documentation generation.
236 ## [2.3.4] - 2022-10-17
240 - Fully automate release process with release-it.
244 - Optimize fair share task scheduling algorithm implementation.
245 - Update benchmarks versus external pools results with latest version.
247 ## [2.3.3] - 2022-10-15
251 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
253 ## [2.3.2] - 2022-10-14
257 - Optimize fair share worker selection strategy implementation.
261 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
263 ## [2.3.1] - 2022-10-13
267 - Pool worker choice strategies:
268 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
269 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
271 ## [2.2.2] - 2022-10-09
275 - Fixed `README.md` file.
277 ## [2.2.1] - 2022-10-08
281 - Dynamic worker choice strategy change at runtime.
283 ## [2.2.0] - 2022-01-05
287 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
289 ## [2.1.0] - 2021-08-29
293 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
297 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
298 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
299 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
300 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
302 ## [2.0.2] - 2021-05-12
306 - Fix `busy` event emission on fixed pool type
308 ## [2.0.1] - 2021-03-16
312 - Check if pool options are properly set.
313 - `busy` event is emitted on all pool types.
315 ## [2.0.0] - 2021-03-01
319 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
323 - `FullPool` event is now renamed to `busy`.
324 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
325 _Find more details on our JSDoc._
327 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
329 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
331 ### Pool options types declaration merge
333 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
335 #### New `export` strategy
339 const DynamicThreadPool = require('poolifier/lib/dynamic')
341 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
344 But you should always prefer just using
347 const { DynamicThreadPool } = require('poolifier')
350 #### New type definitions for input data and response
352 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
353 _This is not a limitation by poolifier but NodeJS._
355 #### Public property replacements
357 `numWorkers` property is now `numberOfWorkers`
359 #### Internal (protected) properties and methods renaming
361 These properties are not intended for end users
363 - `id` => `nextMessageId`
365 These methods are not intended for end users
367 - `_chooseWorker` => `chooseWorker`
368 - `_newWorker` => `createWorker`
369 - `_execute` => `internalExecute`
370 - `_chooseWorker` => `chooseWorker`
371 - `_checkAlive` => `checkAlive`
373 - `_runAsync` => `runAsync`
375 ## [1.1.0] - 2020-05-21
379 - ThreadWorker support async functions as option
380 - Various external library patches
382 ## [1.0.0] - 2020-01-24
386 - FixedThreadPool implementation
387 - DynamicThreadPool implementation
388 - WorkerThread implementation to improve developer experience