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.
16 - Fix missing documentation.
18 ## [2.4.6] - 2023-04-10
22 - Ensure one task at a time is executed per worker with tasks queueing enabled.
23 - Properly count worker running tasks with tasks queueing enabled.
25 ## [2.4.5] - 2023-04-09
29 - Use monotonic high resolution timer for worker tasks run time.
30 - Add worker tasks median run time to statistics.
31 - Add worker tasks queue (experimental).
33 ## [2.4.4] - 2023-04-07
37 - Add `PoolEvents` enumeration and `PoolEvent` type.
41 - Destroy worker only on alive check.
43 ## [2.4.3] - 2023-04-07
47 - Fix typedoc generation with inheritance.
49 ## [2.4.2] - 2023-04-06
53 - Add `full` event to dynamic pool.
54 - Keep worker choice strategy in memory for conditional reuse.
58 - Fix possible negative worker key at worker removal in worker choice strategies.
60 ## [2.4.1] - 2023-04-05
64 - Optimize worker choice strategy for dynamic pool.
68 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
70 ## [2.4.0] - 2023-04-04
74 - Add `LESS_BUSY` worker choice strategy.
78 - Optimize worker storage in pool.
79 - Optimize worker alive status check.
80 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
81 - Optimize `LESS_USED` worker choice strategy.
82 - Update benchmarks versus external threads pools.
83 - Optimize tasks usage statistics requirements for worker choice strategy.
87 - Ensure trimmable characters are checked at pool initialization.
88 - Fix message id integer overflow.
89 - Fix pool worker removal in worker choice strategy internals.
90 - Fix package publication with pnpm.
92 ## [2.4.0-3] - 2023-04-04
96 - Add `LESS_BUSY` worker choice strategy.
100 - Optimize worker storage in pool.
101 - Optimize worker alive status check.
102 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
103 - Optimize `LESS_USED` worker choice strategy.
104 - Update benchmarks versus external threads pools.
108 - Ensure trimmable characters are checked at pool initialization.
109 - Fix message id integer overflow.
110 - Fix pool worker removal in worker choice strategy internals.
111 - Fix package publication with pnpm.
113 ## [2.4.0-2] - 2023-04-03
117 - Add `LESS_BUSY` worker choice strategy.
121 - Optimize worker storage in pool.
122 - Optimize worker alive status check.
123 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
124 - Optimize `LESS_USED` worker choice strategy.
128 - Ensure trimmable characters are checked at pool initialization.
129 - Fix message id integer overflow.
130 - Fix pool worker removal in worker choice strategy internals.
131 - Fix package publication with pnpm.
133 ## [2.4.0-1] - 2023-04-03
137 - Add `LESS_BUSY` worker choice strategy.
141 - Optimize worker storage in pool.
142 - Optimize worker alive status check.
143 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
144 - Optimize `LESS_USED` worker choice strategy.
148 - Ensure trimmable characters are checked at pool initialization.
149 - Fix message id integer overflow.
150 - Fix pool worker removal in worker choice strategy internals.
152 ## [2.4.0-0] - 2023-04-03
156 - Add `LESS_BUSY` worker choice strategy.
160 - Optimize worker storage in pool.
161 - Optimize worker alive status check.
162 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
163 - Optimize `LESS_USED` worker choice strategy.
167 - Ensure trimmable characters are checked at pool initialization.
168 - Fix message id integer overflow.
169 - Fix pool worker removal in worker choice strategy internals.
171 ## [2.3.10] - 2023-03-18
175 - Fix `exports` syntax for ESM and CommonJS.
179 - Permit SemVer pre-release publication.
181 ## [2.3.10-2] - 2023-03-18
185 - Fix `exports` syntax for ESM and CommonJS.
187 ## [2.3.10-1] - 2023-03-18
191 - Permit SemVer pre-release publication.
193 ## [2.3.10-0] - 2023-03-18
197 - Fix `exports` syntax for ESM and CommonJS.
199 ## [2.3.9] - 2023-03-18
203 - Introduce ESM module support along with CommonJS one.
207 - Fix brown paper bag bug referencing the same object literal.
209 ## [2.3.8] - 2023-03-18
213 - Switch internal benchmarking code to benny.
214 - Switch to TypeScript 5.x.x.
215 - Switch rollup bundler plugins to core ones.
216 - Switch to TSDoc syntax.
217 - Enforce conventional commits.
221 - Fix random integer generator.
222 - Fix worker choice strategy pool type identification at initialization.
224 ## [2.3.7] - 2022-10-23
228 - Switch to open collective FOSS project funding platform.
229 - Switch to ts-standard linter configuration on TypeScript code.
233 - Fixed missing async on pool execute method.
234 - Fixed typing in TypeScript example.
235 - Fixed types in unit tests.
237 ## [2.3.6] - 2022-10-22
241 - Cleanup pool attributes and methods.
242 - Refine error types thrown.
246 - Fix continuous integration build on windows.
247 - Fix code coverage reporting by using c8 instead of nyc.
249 ## [2.3.5] - 2022-10-21
253 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
254 - Optimize tasks usage lookup implementation.
258 - Fix missed pool event emitter type export.
259 - Fix typedoc documentation generation.
261 ## [2.3.4] - 2022-10-17
265 - Fully automate release process with release-it.
269 - Optimize fair share task scheduling algorithm implementation.
270 - Update benchmarks versus external pools results with latest version.
272 ## [2.3.3] - 2022-10-15
276 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
278 ## [2.3.2] - 2022-10-14
282 - Optimize fair share worker selection strategy implementation.
286 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
288 ## [2.3.1] - 2022-10-13
292 - Pool worker choice strategies:
293 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
294 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
296 ## [2.2.2] - 2022-10-09
300 - Fixed `README.md` file.
302 ## [2.2.1] - 2022-10-08
306 - Dynamic worker choice strategy change at runtime.
308 ## [2.2.0] - 2022-01-05
312 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
314 ## [2.1.0] - 2021-08-29
318 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
322 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
323 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
324 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
325 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
327 ## [2.0.2] - 2021-05-12
331 - Fix `busy` event emission on fixed pool type
333 ## [2.0.1] - 2021-03-16
337 - Check if pool options are properly set.
338 - `busy` event is emitted on all pool types.
340 ## [2.0.0] - 2021-03-01
344 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
348 - `FullPool` event is now renamed to `busy`.
349 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
350 _Find more details on our JSDoc._
352 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
354 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
356 ### Pool options types declaration merge
358 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
360 #### New `export` strategy
364 const DynamicThreadPool = require('poolifier/lib/dynamic')
366 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
369 But you should always prefer just using
372 const { DynamicThreadPool } = require('poolifier')
375 #### New type definitions for input data and response
377 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
378 _This is not a limitation by poolifier but NodeJS._
380 #### Public property replacements
382 `numWorkers` property is now `numberOfWorkers`
384 #### Internal (protected) properties and methods renaming
386 These properties are not intended for end users
388 - `id` => `nextMessageId`
390 These methods are not intended for end users
392 - `_chooseWorker` => `chooseWorker`
393 - `_newWorker` => `createWorker`
394 - `_execute` => `internalExecute`
395 - `_chooseWorker` => `chooseWorker`
396 - `_checkAlive` => `checkAlive`
398 - `_runAsync` => `runAsync`
400 ## [1.1.0] - 2020-05-21
404 - ThreadWorker support async functions as option
405 - Various external library patches
407 ## [1.0.0] - 2020-01-24
411 - FixedThreadPool implementation
412 - DynamicThreadPool implementation
413 - WorkerThread implementation to improve developer experience