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 worker tasks queue options to pool options.
14 ## [2.4.6] - 2023-04-10
18 - Ensure one task at a time is executed per worker with tasks queueing enabled.
19 - Properly count worker running tasks with tasks queueing enabled.
21 ## [2.4.5] - 2023-04-09
25 - Use monotonic high resolution timer for worker tasks run time.
26 - Add worker tasks median run time to statistics.
27 - Add worker tasks queue (experimental).
29 ## [2.4.4] - 2023-04-07
33 - Add `PoolEvents` enumeration and `PoolEvent` type.
37 - Destroy worker only on alive check.
39 ## [2.4.3] - 2023-04-07
43 - Fix typedoc generation with inheritance.
45 ## [2.4.2] - 2023-04-06
49 - Add `full` event to dynamic pool.
50 - Keep worker choice strategy in memory for conditional reuse.
54 - Fix possible negative worker key at worker removal in worker choice strategies.
56 ## [2.4.1] - 2023-04-05
60 - Optimize worker choice strategy for dynamic pool.
64 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
66 ## [2.4.0] - 2023-04-04
70 - Add `LESS_BUSY` worker choice strategy.
74 - Optimize worker storage in pool.
75 - Optimize worker alive status check.
76 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
77 - Optimize `LESS_USED` worker choice strategy.
78 - Update benchmarks versus external threads pools.
79 - Optimize tasks usage statistics requirements for 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.
86 - Fix package publication with pnpm.
88 ## [2.4.0-3] - 2023-04-04
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.
100 - Update benchmarks versus external threads pools.
104 - Ensure trimmable characters are checked at pool initialization.
105 - Fix message id integer overflow.
106 - Fix pool worker removal in worker choice strategy internals.
107 - Fix package publication with pnpm.
109 ## [2.4.0-2] - 2023-04-03
113 - Add `LESS_BUSY` worker choice strategy.
117 - Optimize worker storage in pool.
118 - Optimize worker alive status check.
119 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
120 - Optimize `LESS_USED` worker choice strategy.
124 - Ensure trimmable characters are checked at pool initialization.
125 - Fix message id integer overflow.
126 - Fix pool worker removal in worker choice strategy internals.
127 - Fix package publication with pnpm.
129 ## [2.4.0-1] - 2023-04-03
133 - Add `LESS_BUSY` worker choice strategy.
137 - Optimize worker storage in pool.
138 - Optimize worker alive status check.
139 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
140 - Optimize `LESS_USED` worker choice strategy.
144 - Ensure trimmable characters are checked at pool initialization.
145 - Fix message id integer overflow.
146 - Fix pool worker removal in worker choice strategy internals.
148 ## [2.4.0-0] - 2023-04-03
152 - Add `LESS_BUSY` worker choice strategy.
156 - Optimize worker storage in pool.
157 - Optimize worker alive status check.
158 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
159 - Optimize `LESS_USED` worker choice strategy.
163 - Ensure trimmable characters are checked at pool initialization.
164 - Fix message id integer overflow.
165 - Fix pool worker removal in worker choice strategy internals.
167 ## [2.3.10] - 2023-03-18
171 - Fix `exports` syntax for ESM and CommonJS.
175 - Permit SemVer pre-release publication.
177 ## [2.3.10-2] - 2023-03-18
181 - Fix `exports` syntax for ESM and CommonJS.
183 ## [2.3.10-1] - 2023-03-18
187 - Permit SemVer pre-release publication.
189 ## [2.3.10-0] - 2023-03-18
193 - Fix `exports` syntax for ESM and CommonJS.
195 ## [2.3.9] - 2023-03-18
199 - Introduce ESM module support along with CommonJS one.
203 - Fix brown paper bag bug referencing the same object literal.
205 ## [2.3.8] - 2023-03-18
209 - Switch internal benchmarking code to benny.
210 - Switch to TypeScript 5.x.x.
211 - Switch rollup bundler plugins to core ones.
212 - Switch to TSDoc syntax.
213 - Enforce conventional commits.
217 - Fix random integer generator.
218 - Fix worker choice strategy pool type identification at initialization.
220 ## [2.3.7] - 2022-10-23
224 - Switch to open collective FOSS project funding platform.
225 - Switch to ts-standard linter configuration on TypeScript code.
229 - Fixed missing async on pool execute method.
230 - Fixed typing in TypeScript example.
231 - Fixed types in unit tests.
233 ## [2.3.6] - 2022-10-22
237 - Cleanup pool attributes and methods.
238 - Refine error types thrown.
242 - Fix continuous integration build on windows.
243 - Fix code coverage reporting by using c8 instead of nyc.
245 ## [2.3.5] - 2022-10-21
249 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
250 - Optimize tasks usage lookup implementation.
254 - Fix missed pool event emitter type export.
255 - Fix typedoc documentation generation.
257 ## [2.3.4] - 2022-10-17
261 - Fully automate release process with release-it.
265 - Optimize fair share task scheduling algorithm implementation.
266 - Update benchmarks versus external pools results with latest version.
268 ## [2.3.3] - 2022-10-15
272 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
274 ## [2.3.2] - 2022-10-14
278 - Optimize fair share worker selection strategy implementation.
282 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
284 ## [2.3.1] - 2022-10-13
288 - Pool worker choice strategies:
289 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
290 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
292 ## [2.2.2] - 2022-10-09
296 - Fixed `README.md` file.
298 ## [2.2.1] - 2022-10-08
302 - Dynamic worker choice strategy change at runtime.
304 ## [2.2.0] - 2022-01-05
308 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
310 ## [2.1.0] - 2021-08-29
314 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
318 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
319 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
320 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
321 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
323 ## [2.0.2] - 2021-05-12
327 - Fix `busy` event emission on fixed pool type
329 ## [2.0.1] - 2021-03-16
333 - Check if pool options are properly set.
334 - `busy` event is emitted on all pool types.
336 ## [2.0.0] - 2021-03-01
340 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
344 - `FullPool` event is now renamed to `busy`.
345 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
346 _Find more details on our JSDoc._
348 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
350 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
352 ### Pool options types declaration merge
354 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
356 #### New `export` strategy
360 const DynamicThreadPool = require('poolifier/lib/dynamic')
362 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
365 But you should always prefer just using
368 const { DynamicThreadPool } = require('poolifier')
371 #### New type definitions for input data and response
373 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
374 _This is not a limitation by poolifier but NodeJS._
376 #### Public property replacements
378 `numWorkers` property is now `numberOfWorkers`
380 #### Internal (protected) properties and methods renaming
382 These properties are not intended for end users
384 - `id` => `nextMessageId`
386 These methods are not intended for end users
388 - `_chooseWorker` => `chooseWorker`
389 - `_newWorker` => `createWorker`
390 - `_execute` => `internalExecute`
391 - `_chooseWorker` => `chooseWorker`
392 - `_checkAlive` => `checkAlive`
394 - `_runAsync` => `runAsync`
396 ## [1.1.0] - 2020-05-21
400 - ThreadWorker support async functions as option
401 - Various external library patches
403 ## [1.0.0] - 2020-01-24
407 - FixedThreadPool implementation
408 - DynamicThreadPool implementation
409 - WorkerThread implementation to improve developer experience