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 - Use monotonic high resolution timer for worker tasks run time.
13 - Add worker tasks median run time to statistics.
14 - Add worker tasks queue (experimental).
16 ## [2.4.4] - 2023-04-07
20 - Add `PoolEvents` enumeration and `PoolEvent` type.
24 - Destroy worker only on alive check.
26 ## [2.4.3] - 2023-04-07
30 - Fix typedoc generation with inheritance.
32 ## [2.4.2] - 2023-04-06
36 - Add `full` event to dynamic pool.
37 - Keep worker choice strategy in memory for conditional reuse.
41 - Fix possible negative worker key at worker removal in worker choice strategies.
43 ## [2.4.1] - 2023-04-05
47 - Optimize worker choice strategy for dynamic pool.
51 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
53 ## [2.4.0] - 2023-04-04
57 - Add `LESS_BUSY` worker choice strategy.
61 - Optimize worker storage in pool.
62 - Optimize worker alive status check.
63 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
64 - Optimize `LESS_USED` worker choice strategy.
65 - Update benchmarks versus external threads pools.
66 - Optimize tasks usage statistics requirements for worker choice strategy.
70 - Ensure trimmable characters are checked at pool initialization.
71 - Fix message id integer overflow.
72 - Fix pool worker removal in worker choice strategy internals.
73 - Fix package publication with pnpm.
75 ## [2.4.0-3] - 2023-04-04
79 - Add `LESS_BUSY` worker choice strategy.
83 - Optimize worker storage in pool.
84 - Optimize worker alive status check.
85 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
86 - Optimize `LESS_USED` worker choice strategy.
87 - Update benchmarks versus external threads pools.
91 - Ensure trimmable characters are checked at pool initialization.
92 - Fix message id integer overflow.
93 - Fix pool worker removal in worker choice strategy internals.
94 - Fix package publication with pnpm.
96 ## [2.4.0-2] - 2023-04-03
100 - Add `LESS_BUSY` worker choice strategy.
104 - Optimize worker storage in pool.
105 - Optimize worker alive status check.
106 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
107 - Optimize `LESS_USED` worker choice strategy.
111 - Ensure trimmable characters are checked at pool initialization.
112 - Fix message id integer overflow.
113 - Fix pool worker removal in worker choice strategy internals.
114 - Fix package publication with pnpm.
116 ## [2.4.0-1] - 2023-04-03
120 - Add `LESS_BUSY` worker choice strategy.
124 - Optimize worker storage in pool.
125 - Optimize worker alive status check.
126 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
127 - Optimize `LESS_USED` worker choice strategy.
131 - Ensure trimmable characters are checked at pool initialization.
132 - Fix message id integer overflow.
133 - Fix pool worker removal in worker choice strategy internals.
135 ## [2.4.0-0] - 2023-04-03
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.
150 - Ensure trimmable characters are checked at pool initialization.
151 - Fix message id integer overflow.
152 - Fix pool worker removal in worker choice strategy internals.
154 ## [2.3.10] - 2023-03-18
158 - Fix `exports` syntax for ESM and CommonJS.
162 - Permit SemVer pre-release publication.
164 ## [2.3.10-2] - 2023-03-18
168 - Fix `exports` syntax for ESM and CommonJS.
170 ## [2.3.10-1] - 2023-03-18
174 - Permit SemVer pre-release publication.
176 ## [2.3.10-0] - 2023-03-18
180 - Fix `exports` syntax for ESM and CommonJS.
182 ## [2.3.9] - 2023-03-18
186 - Introduce ESM module support along with CommonJS one.
190 - Fix brown paper bag bug referencing the same object literal.
192 ## [2.3.8] - 2023-03-18
196 - Switch internal benchmarking code to benny.
197 - Switch to TypeScript 5.x.x.
198 - Switch rollup bundler plugins to core ones.
199 - Switch to TSDoc syntax.
200 - Enforce conventional commits.
204 - Fix random integer generator.
205 - Fix worker choice strategy pool type identification at initialization.
207 ## [2.3.7] - 2022-10-23
211 - Switch to open collective FOSS project funding platform.
212 - Switch to ts-standard linter configuration on TypeScript code.
216 - Fixed missing async on pool execute method.
217 - Fixed typing in TypeScript example.
218 - Fixed types in unit tests.
220 ## [2.3.6] - 2022-10-22
224 - Cleanup pool attributes and methods.
225 - Refine error types thrown.
229 - Fix continuous integration build on windows.
230 - Fix code coverage reporting by using c8 instead of nyc.
232 ## [2.3.5] - 2022-10-21
236 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
237 - Optimize tasks usage lookup implementation.
241 - Fix missed pool event emitter type export.
242 - Fix typedoc documentation generation.
244 ## [2.3.4] - 2022-10-17
248 - Fully automate release process with release-it.
252 - Optimize fair share task scheduling algorithm implementation.
253 - Update benchmarks versus external pools results with latest version.
255 ## [2.3.3] - 2022-10-15
259 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
261 ## [2.3.2] - 2022-10-14
265 - Optimize fair share worker selection strategy implementation.
269 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
271 ## [2.3.1] - 2022-10-13
275 - Pool worker choice strategies:
276 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
277 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
279 ## [2.2.2] - 2022-10-09
283 - Fixed `README.md` file.
285 ## [2.2.1] - 2022-10-08
289 - Dynamic worker choice strategy change at runtime.
291 ## [2.2.0] - 2022-01-05
295 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
297 ## [2.1.0] - 2021-08-29
301 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
305 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
306 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
307 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
308 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
310 ## [2.0.2] - 2021-05-12
314 - Fix `busy` event emission on fixed pool type
316 ## [2.0.1] - 2021-03-16
320 - Check if pool options are properly set.
321 - `busy` event is emitted on all pool types.
323 ## [2.0.0] - 2021-03-01
327 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
331 - `FullPool` event is now renamed to `busy`.
332 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
333 _Find more details on our JSDoc._
335 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
337 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
339 ### Pool options types declaration merge
341 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
343 #### New `export` strategy
347 const DynamicThreadPool = require('poolifier/lib/dynamic')
349 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
352 But you should always prefer just using
355 const { DynamicThreadPool } = require('poolifier')
358 #### New type definitions for input data and response
360 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
361 _This is not a limitation by poolifier but NodeJS._
363 #### Public property replacements
365 `numWorkers` property is now `numberOfWorkers`
367 #### Internal (protected) properties and methods renaming
369 These properties are not intended for end users
371 - `id` => `nextMessageId`
373 These methods are not intended for end users
375 - `_chooseWorker` => `chooseWorker`
376 - `_newWorker` => `createWorker`
377 - `_execute` => `internalExecute`
378 - `_chooseWorker` => `chooseWorker`
379 - `_checkAlive` => `checkAlive`
381 - `_runAsync` => `runAsync`
383 ## [1.1.0] - 2020-05-21
387 - ThreadWorker support async functions as option
388 - Various external library patches
390 ## [1.0.0] - 2020-01-24
394 - FixedThreadPool implementation
395 - DynamicThreadPool implementation
396 - WorkerThread implementation to improve developer experience