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 `LESS_BUSY` worker choice strategy.
16 - Optimize worker storage in pool.
17 - Optimize worker alive status check.
18 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
19 - Optimize `LESS_USED` worker choice strategy.
20 - Update benchmarks versus external threads pools.
24 - Ensure trimmable characters are checked at pool initialization.
25 - Fix message id integer overflow.
26 - Fix pool worker removal in worker choice strategy internals.
27 - Fix package publication with pnpm.
29 ## [2.4.0-2] - 2023-04-03
33 - Add `LESS_BUSY` worker choice strategy.
37 - Optimize worker storage in pool.
38 - Optimize worker alive status check.
39 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
40 - Optimize `LESS_USED` worker choice strategy.
44 - Ensure trimmable characters are checked at pool initialization.
45 - Fix message id integer overflow.
46 - Fix pool worker removal in worker choice strategy internals.
47 - Fix package publication with pnpm.
49 ## [2.4.0-1] - 2023-04-03
53 - Add `LESS_BUSY` worker choice strategy.
57 - Optimize worker storage in pool.
58 - Optimize worker alive status check.
59 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
60 - Optimize `LESS_USED` worker choice strategy.
64 - Ensure trimmable characters are checked at pool initialization.
65 - Fix message id integer overflow.
66 - Fix pool worker removal in worker choice strategy internals.
68 ## [2.4.0-0] - 2023-04-03
72 - Add `LESS_BUSY` worker choice strategy.
76 - Optimize worker storage in pool.
77 - Optimize worker alive status check.
78 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
79 - Optimize `LESS_USED` worker choice strategy.
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.
87 ## [2.3.10] - 2023-03-18
91 - Fix `exports` syntax for ESM and CommonJS.
95 - Permit SemVer pre-release publication.
97 ## [2.3.10-2] - 2023-03-18
101 - Fix `exports` syntax for ESM and CommonJS.
103 ## [2.3.10-1] - 2023-03-18
107 - Permit SemVer pre-release publication.
109 ## [2.3.10-0] - 2023-03-18
113 - Fix `exports` syntax for ESM and CommonJS.
115 ## [2.3.9] - 2023-03-18
119 - Introduce ESM module support along with CommonJS one.
123 - Fix brown paper bag bug referencing the same object literal.
125 ## [2.3.8] - 2023-03-18
129 - Switch internal benchmarking code to benny.
130 - Switch to TypeScript 5.x.x.
131 - Switch rollup bundler plugins to core ones.
132 - Switch to TSDoc syntax.
133 - Enforce conventional commits.
137 - Fix random integer generator.
138 - Fix worker choice strategy pool type identification at initialization.
140 ## [2.3.7] - 2022-10-23
144 - Switch to open collective FOSS project funding platform.
145 - Switch to ts-standard linter configuration on TypeScript code.
149 - Fixed missing async on pool execute method.
150 - Fixed typing in TypeScript example.
151 - Fixed types in unit tests.
153 ## [2.3.6] - 2022-10-22
157 - Cleanup pool attributes and methods.
158 - Refine error types thrown.
162 - Fix continuous integration build on windows.
163 - Fix code coverage reporting by using c8 instead of nyc.
165 ## [2.3.5] - 2022-10-21
169 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
170 - Optimize tasks usage lookup implementation.
174 - Fix missed pool event emitter type export.
175 - Fix typedoc documentation generation.
177 ## [2.3.4] - 2022-10-17
181 - Fully automate release process with release-it.
185 - Optimize fair share task scheduling algorithm implementation.
186 - Update benchmarks versus external pools results with latest version.
188 ## [2.3.3] - 2022-10-15
192 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
194 ## [2.3.2] - 2022-10-14
198 - Optimize fair share worker selection strategy implementation.
202 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
204 ## [2.3.1] - 2022-10-13
208 - Pool worker choice strategies:
209 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
210 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
212 ## [2.2.2] - 2022-10-09
216 - Fixed `README.md` file.
218 ## [2.2.1] - 2022-10-08
222 - Dynamic worker choice strategy change at runtime.
224 ## [2.2.0] - 2022-01-05
228 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
230 ## [2.1.0] - 2021-08-29
234 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
238 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
239 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
240 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
241 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
243 ## [2.0.2] - 2021-05-12
247 - Fix `busy` event emission on fixed pool type
249 ## [2.0.1] - 2021-03-16
253 - Check if pool options are properly set.
254 - `busy` event is emitted on all pool types.
256 ## [2.0.0] - 2021-03-01
260 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
264 - `FullPool` event is now renamed to `busy`.
265 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
266 _Find more details on our JSDoc._
268 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
270 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
272 ### Pool options types declaration merge
274 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
276 #### New `export` strategy
280 const DynamicThreadPool = require('poolifier/lib/dynamic')
282 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
285 But you should always prefer just using
288 const { DynamicThreadPool } = require('poolifier')
291 #### New type definitions for input data and response
293 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
294 _This is not a limitation by poolifier but NodeJS._
296 #### Public property replacements
298 `numWorkers` property is now `numberOfWorkers`
300 #### Internal (protected) properties and methods renaming
302 These properties are not intended for end users
304 - `id` => `nextMessageId`
306 These methods are not intended for end users
308 - `_chooseWorker` => `chooseWorker`
309 - `_newWorker` => `createWorker`
310 - `_execute` => `internalExecute`
311 - `_chooseWorker` => `chooseWorker`
312 - `_checkAlive` => `checkAlive`
314 - `_runAsync` => `runAsync`
316 ## [1.1.0] - 2020-05-21
320 - ThreadWorker support async functions as option
321 - Various external library patches
323 ## [1.0.0] - 2020-01-24
327 - FixedThreadPool implementation
328 - DynamicThreadPool implementation
329 - WorkerThread implementation to improve developer experience