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.
15 ## [2.4.4] - 2023-04-07
19 - Add `PoolEvents` enumeration and `PoolEvent` type.
23 - Destroy worker only on alive check.
25 ## [2.4.3] - 2023-04-07
29 - Fix typedoc generation with inheritance.
31 ## [2.4.2] - 2023-04-06
35 - Add `full` event to dynamic pool.
36 - Keep worker choice strategy in memory for conditional reuse.
40 - Fix possible negative worker key at worker removal in worker choice strategies.
42 ## [2.4.1] - 2023-04-05
46 - Optimize worker choice strategy for dynamic pool.
50 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
52 ## [2.4.0] - 2023-04-04
56 - Add `LESS_BUSY` worker choice strategy.
60 - Optimize worker storage in pool.
61 - Optimize worker alive status check.
62 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
63 - Optimize `LESS_USED` worker choice strategy.
64 - Update benchmarks versus external threads pools.
65 - Optimize tasks usage statistics requirements for worker choice strategy.
69 - Ensure trimmable characters are checked at pool initialization.
70 - Fix message id integer overflow.
71 - Fix pool worker removal in worker choice strategy internals.
72 - Fix package publication with pnpm.
74 ## [2.4.0-3] - 2023-04-04
78 - Add `LESS_BUSY` worker choice strategy.
82 - Optimize worker storage in pool.
83 - Optimize worker alive status check.
84 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
85 - Optimize `LESS_USED` worker choice strategy.
86 - Update benchmarks versus external threads pools.
90 - Ensure trimmable characters are checked at pool initialization.
91 - Fix message id integer overflow.
92 - Fix pool worker removal in worker choice strategy internals.
93 - Fix package publication with pnpm.
95 ## [2.4.0-2] - 2023-04-03
99 - Add `LESS_BUSY` worker choice strategy.
103 - Optimize worker storage in pool.
104 - Optimize worker alive status check.
105 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
106 - Optimize `LESS_USED` worker choice strategy.
110 - Ensure trimmable characters are checked at pool initialization.
111 - Fix message id integer overflow.
112 - Fix pool worker removal in worker choice strategy internals.
113 - Fix package publication with pnpm.
115 ## [2.4.0-1] - 2023-04-03
119 - Add `LESS_BUSY` worker choice strategy.
123 - Optimize worker storage in pool.
124 - Optimize worker alive status check.
125 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
126 - Optimize `LESS_USED` worker choice strategy.
130 - Ensure trimmable characters are checked at pool initialization.
131 - Fix message id integer overflow.
132 - Fix pool worker removal in worker choice strategy internals.
134 ## [2.4.0-0] - 2023-04-03
138 - Add `LESS_BUSY` worker choice strategy.
142 - Optimize worker storage in pool.
143 - Optimize worker alive status check.
144 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
145 - Optimize `LESS_USED` worker choice strategy.
149 - Ensure trimmable characters are checked at pool initialization.
150 - Fix message id integer overflow.
151 - Fix pool worker removal in worker choice strategy internals.
153 ## [2.3.10] - 2023-03-18
157 - Fix `exports` syntax for ESM and CommonJS.
161 - Permit SemVer pre-release publication.
163 ## [2.3.10-2] - 2023-03-18
167 - Fix `exports` syntax for ESM and CommonJS.
169 ## [2.3.10-1] - 2023-03-18
173 - Permit SemVer pre-release publication.
175 ## [2.3.10-0] - 2023-03-18
179 - Fix `exports` syntax for ESM and CommonJS.
181 ## [2.3.9] - 2023-03-18
185 - Introduce ESM module support along with CommonJS one.
189 - Fix brown paper bag bug referencing the same object literal.
191 ## [2.3.8] - 2023-03-18
195 - Switch internal benchmarking code to benny.
196 - Switch to TypeScript 5.x.x.
197 - Switch rollup bundler plugins to core ones.
198 - Switch to TSDoc syntax.
199 - Enforce conventional commits.
203 - Fix random integer generator.
204 - Fix worker choice strategy pool type identification at initialization.
206 ## [2.3.7] - 2022-10-23
210 - Switch to open collective FOSS project funding platform.
211 - Switch to ts-standard linter configuration on TypeScript code.
215 - Fixed missing async on pool execute method.
216 - Fixed typing in TypeScript example.
217 - Fixed types in unit tests.
219 ## [2.3.6] - 2022-10-22
223 - Cleanup pool attributes and methods.
224 - Refine error types thrown.
228 - Fix continuous integration build on windows.
229 - Fix code coverage reporting by using c8 instead of nyc.
231 ## [2.3.5] - 2022-10-21
235 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
236 - Optimize tasks usage lookup implementation.
240 - Fix missed pool event emitter type export.
241 - Fix typedoc documentation generation.
243 ## [2.3.4] - 2022-10-17
247 - Fully automate release process with release-it.
251 - Optimize fair share task scheduling algorithm implementation.
252 - Update benchmarks versus external pools results with latest version.
254 ## [2.3.3] - 2022-10-15
258 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
260 ## [2.3.2] - 2022-10-14
264 - Optimize fair share worker selection strategy implementation.
268 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
270 ## [2.3.1] - 2022-10-13
274 - Pool worker choice strategies:
275 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
276 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
278 ## [2.2.2] - 2022-10-09
282 - Fixed `README.md` file.
284 ## [2.2.1] - 2022-10-08
288 - Dynamic worker choice strategy change at runtime.
290 ## [2.2.0] - 2022-01-05
294 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
296 ## [2.1.0] - 2021-08-29
300 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
304 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
305 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
306 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
307 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
309 ## [2.0.2] - 2021-05-12
313 - Fix `busy` event emission on fixed pool type
315 ## [2.0.1] - 2021-03-16
319 - Check if pool options are properly set.
320 - `busy` event is emitted on all pool types.
322 ## [2.0.0] - 2021-03-01
326 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
330 - `FullPool` event is now renamed to `busy`.
331 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
332 _Find more details on our JSDoc._
334 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
336 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
338 ### Pool options types declaration merge
340 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
342 #### New `export` strategy
346 const DynamicThreadPool = require('poolifier/lib/dynamic')
348 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
351 But you should always prefer just using
354 const { DynamicThreadPool } = require('poolifier')
357 #### New type definitions for input data and response
359 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
360 _This is not a limitation by poolifier but NodeJS._
362 #### Public property replacements
364 `numWorkers` property is now `numberOfWorkers`
366 #### Internal (protected) properties and methods renaming
368 These properties are not intended for end users
370 - `id` => `nextMessageId`
372 These methods are not intended for end users
374 - `_chooseWorker` => `chooseWorker`
375 - `_newWorker` => `createWorker`
376 - `_execute` => `internalExecute`
377 - `_chooseWorker` => `chooseWorker`
378 - `_checkAlive` => `checkAlive`
380 - `_runAsync` => `runAsync`
382 ## [1.1.0] - 2020-05-21
386 - ThreadWorker support async functions as option
387 - Various external library patches
389 ## [1.0.0] - 2020-01-24
393 - FixedThreadPool implementation
394 - DynamicThreadPool implementation
395 - WorkerThread implementation to improve developer experience