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 - fix: destroy worker only on check alive.
14 ## [2.4.3] - 2023-04-07
18 - Fix typedoc generation with inheritance.
20 ## [2.4.2] - 2023-04-06
24 - Add `full` event to dynamic pool.
25 - Keep worker choice strategy in memory for conditional reuse.
29 - Fix possible negative worker key at worker removal in worker choice strategies.
31 ## [2.4.1] - 2023-04-05
35 - Optimize worker choice strategy for dynamic pool.
39 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
41 ## [2.4.0] - 2023-04-04
45 - Add `LESS_BUSY` worker choice strategy.
49 - Optimize worker storage in pool.
50 - Optimize worker alive status check.
51 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
52 - Optimize `LESS_USED` worker choice strategy.
53 - Update benchmarks versus external threads pools.
54 - Optimize tasks usage statistics requirements for worker choice strategy.
58 - Ensure trimmable characters are checked at pool initialization.
59 - Fix message id integer overflow.
60 - Fix pool worker removal in worker choice strategy internals.
61 - Fix package publication with pnpm.
63 ## [2.4.0-3] - 2023-04-04
67 - Add `LESS_BUSY` worker choice strategy.
71 - Optimize worker storage in pool.
72 - Optimize worker alive status check.
73 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
74 - Optimize `LESS_USED` worker choice strategy.
75 - Update benchmarks versus external threads pools.
79 - Ensure trimmable characters are checked at pool initialization.
80 - Fix message id integer overflow.
81 - Fix pool worker removal in worker choice strategy internals.
82 - Fix package publication with pnpm.
84 ## [2.4.0-2] - 2023-04-03
88 - Add `LESS_BUSY` worker choice strategy.
92 - Optimize worker storage in pool.
93 - Optimize worker alive status check.
94 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
95 - Optimize `LESS_USED` worker choice strategy.
99 - Ensure trimmable characters are checked at pool initialization.
100 - Fix message id integer overflow.
101 - Fix pool worker removal in worker choice strategy internals.
102 - Fix package publication with pnpm.
104 ## [2.4.0-1] - 2023-04-03
108 - Add `LESS_BUSY` worker choice strategy.
112 - Optimize worker storage in pool.
113 - Optimize worker alive status check.
114 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
115 - Optimize `LESS_USED` worker choice strategy.
119 - Ensure trimmable characters are checked at pool initialization.
120 - Fix message id integer overflow.
121 - Fix pool worker removal in worker choice strategy internals.
123 ## [2.4.0-0] - 2023-04-03
127 - Add `LESS_BUSY` worker choice strategy.
131 - Optimize worker storage in pool.
132 - Optimize worker alive status check.
133 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
134 - Optimize `LESS_USED` worker choice strategy.
138 - Ensure trimmable characters are checked at pool initialization.
139 - Fix message id integer overflow.
140 - Fix pool worker removal in worker choice strategy internals.
142 ## [2.3.10] - 2023-03-18
146 - Fix `exports` syntax for ESM and CommonJS.
150 - Permit SemVer pre-release publication.
152 ## [2.3.10-2] - 2023-03-18
156 - Fix `exports` syntax for ESM and CommonJS.
158 ## [2.3.10-1] - 2023-03-18
162 - Permit SemVer pre-release publication.
164 ## [2.3.10-0] - 2023-03-18
168 - Fix `exports` syntax for ESM and CommonJS.
170 ## [2.3.9] - 2023-03-18
174 - Introduce ESM module support along with CommonJS one.
178 - Fix brown paper bag bug referencing the same object literal.
180 ## [2.3.8] - 2023-03-18
184 - Switch internal benchmarking code to benny.
185 - Switch to TypeScript 5.x.x.
186 - Switch rollup bundler plugins to core ones.
187 - Switch to TSDoc syntax.
188 - Enforce conventional commits.
192 - Fix random integer generator.
193 - Fix worker choice strategy pool type identification at initialization.
195 ## [2.3.7] - 2022-10-23
199 - Switch to open collective FOSS project funding platform.
200 - Switch to ts-standard linter configuration on TypeScript code.
204 - Fixed missing async on pool execute method.
205 - Fixed typing in TypeScript example.
206 - Fixed types in unit tests.
208 ## [2.3.6] - 2022-10-22
212 - Cleanup pool attributes and methods.
213 - Refine error types thrown.
217 - Fix continuous integration build on windows.
218 - Fix code coverage reporting by using c8 instead of nyc.
220 ## [2.3.5] - 2022-10-21
224 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
225 - Optimize tasks usage lookup implementation.
229 - Fix missed pool event emitter type export.
230 - Fix typedoc documentation generation.
232 ## [2.3.4] - 2022-10-17
236 - Fully automate release process with release-it.
240 - Optimize fair share task scheduling algorithm implementation.
241 - Update benchmarks versus external pools results with latest version.
243 ## [2.3.3] - 2022-10-15
247 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
249 ## [2.3.2] - 2022-10-14
253 - Optimize fair share worker selection strategy implementation.
257 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
259 ## [2.3.1] - 2022-10-13
263 - Pool worker choice strategies:
264 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
265 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
267 ## [2.2.2] - 2022-10-09
271 - Fixed `README.md` file.
273 ## [2.2.1] - 2022-10-08
277 - Dynamic worker choice strategy change at runtime.
279 ## [2.2.0] - 2022-01-05
283 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
285 ## [2.1.0] - 2021-08-29
289 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
293 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
294 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
295 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
296 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
298 ## [2.0.2] - 2021-05-12
302 - Fix `busy` event emission on fixed pool type
304 ## [2.0.1] - 2021-03-16
308 - Check if pool options are properly set.
309 - `busy` event is emitted on all pool types.
311 ## [2.0.0] - 2021-03-01
315 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
319 - `FullPool` event is now renamed to `busy`.
320 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
321 _Find more details on our JSDoc._
323 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
325 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
327 ### Pool options types declaration merge
329 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
331 #### New `export` strategy
335 const DynamicThreadPool = require('poolifier/lib/dynamic')
337 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
340 But you should always prefer just using
343 const { DynamicThreadPool } = require('poolifier')
346 #### New type definitions for input data and response
348 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
349 _This is not a limitation by poolifier but NodeJS._
351 #### Public property replacements
353 `numWorkers` property is now `numberOfWorkers`
355 #### Internal (protected) properties and methods renaming
357 These properties are not intended for end users
359 - `id` => `nextMessageId`
361 These methods are not intended for end users
363 - `_chooseWorker` => `chooseWorker`
364 - `_newWorker` => `createWorker`
365 - `_execute` => `internalExecute`
366 - `_chooseWorker` => `chooseWorker`
367 - `_checkAlive` => `checkAlive`
369 - `_runAsync` => `runAsync`
371 ## [1.1.0] - 2020-05-21
375 - ThreadWorker support async functions as option
376 - Various external library patches
378 ## [1.0.0] - 2020-01-24
382 - FixedThreadPool implementation
383 - DynamicThreadPool implementation
384 - WorkerThread implementation to improve developer experience