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).
10 ## [2.4.9] - 2023-04-15
14 - Add tasks queue enablement runtime setter to pool.
15 - Add tasks queue options runtime setter to pool.
16 - Add worker choice strategy options runtime setter to pool.
20 - Remove the tasks queuing experimental status.
24 - Fix worker function type definition and validation.
25 - Fix worker choice strategy options handling.
27 ## [2.4.8] - 2023-04-12
31 - Fix message between main worker and worker type definition for tasks.
32 - Fix code documentation.
34 ## [2.4.7] - 2023-04-11
38 - Add worker tasks queue options to pool options.
42 - Fix missing documentation.
44 ## [2.4.6] - 2023-04-10
48 - Ensure one task at a time is executed per worker with tasks queueing enabled.
49 - Properly count worker running tasks with tasks queueing enabled.
51 ## [2.4.5] - 2023-04-09
55 - Use monotonic high resolution timer for worker tasks run time.
56 - Add worker tasks median run time to statistics.
57 - Add worker tasks queue (experimental).
59 ## [2.4.4] - 2023-04-07
63 - Add `PoolEvents` enumeration and `PoolEvent` type.
67 - Destroy worker only on alive check.
69 ## [2.4.3] - 2023-04-07
73 - Fix typedoc generation with inheritance.
75 ## [2.4.2] - 2023-04-06
79 - Add `full` event to dynamic pool.
80 - Keep worker choice strategy in memory for conditional reuse.
84 - Fix possible negative worker key at worker removal in worker choice strategies.
86 ## [2.4.1] - 2023-04-05
90 - Optimize worker choice strategy for dynamic pool.
94 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
96 ## [2.4.0] - 2023-04-04
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.
108 - Update benchmarks versus external threads pools.
109 - Optimize tasks usage statistics requirements for worker choice strategy.
113 - Ensure trimmable characters are checked at pool initialization.
114 - Fix message id integer overflow.
115 - Fix pool worker removal in worker choice strategy internals.
116 - Fix package publication with pnpm.
118 ## [2.4.0-3] - 2023-04-04
122 - Add `LESS_BUSY` worker choice strategy.
126 - Optimize worker storage in pool.
127 - Optimize worker alive status check.
128 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
129 - Optimize `LESS_USED` worker choice strategy.
130 - Update benchmarks versus external threads pools.
134 - Ensure trimmable characters are checked at pool initialization.
135 - Fix message id integer overflow.
136 - Fix pool worker removal in worker choice strategy internals.
137 - Fix package publication with pnpm.
139 ## [2.4.0-2] - 2023-04-03
143 - Add `LESS_BUSY` worker choice strategy.
147 - Optimize worker storage in pool.
148 - Optimize worker alive status check.
149 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
150 - Optimize `LESS_USED` worker choice strategy.
154 - Ensure trimmable characters are checked at pool initialization.
155 - Fix message id integer overflow.
156 - Fix pool worker removal in worker choice strategy internals.
157 - Fix package publication with pnpm.
159 ## [2.4.0-1] - 2023-04-03
163 - Add `LESS_BUSY` worker choice strategy.
167 - Optimize worker storage in pool.
168 - Optimize worker alive status check.
169 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
170 - Optimize `LESS_USED` worker choice strategy.
174 - Ensure trimmable characters are checked at pool initialization.
175 - Fix message id integer overflow.
176 - Fix pool worker removal in worker choice strategy internals.
178 ## [2.4.0-0] - 2023-04-03
182 - Add `LESS_BUSY` worker choice strategy.
186 - Optimize worker storage in pool.
187 - Optimize worker alive status check.
188 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
189 - Optimize `LESS_USED` worker choice strategy.
193 - Ensure trimmable characters are checked at pool initialization.
194 - Fix message id integer overflow.
195 - Fix pool worker removal in worker choice strategy internals.
197 ## [2.3.10] - 2023-03-18
201 - Fix `exports` syntax for ESM and CommonJS.
205 - Permit SemVer pre-release publication.
207 ## [2.3.10-2] - 2023-03-18
211 - Fix `exports` syntax for ESM and CommonJS.
213 ## [2.3.10-1] - 2023-03-18
217 - Permit SemVer pre-release publication.
219 ## [2.3.10-0] - 2023-03-18
223 - Fix `exports` syntax for ESM and CommonJS.
225 ## [2.3.9] - 2023-03-18
229 - Introduce ESM module support along with CommonJS one.
233 - Fix brown paper bag bug referencing the same object literal.
235 ## [2.3.8] - 2023-03-18
239 - Switch internal benchmarking code to benny.
240 - Switch to TypeScript 5.x.x.
241 - Switch rollup bundler plugins to core ones.
242 - Switch to TSDoc syntax.
243 - Enforce conventional commits.
247 - Fix random integer generator.
248 - Fix worker choice strategy pool type identification at initialization.
250 ## [2.3.7] - 2022-10-23
254 - Switch to open collective FOSS project funding platform.
255 - Switch to ts-standard linter configuration on TypeScript code.
259 - Fixed missing async on pool execute method.
260 - Fixed typing in TypeScript example.
261 - Fixed types in unit tests.
263 ## [2.3.6] - 2022-10-22
267 - Cleanup pool attributes and methods.
268 - Refine error types thrown.
272 - Fix continuous integration build on windows.
273 - Fix code coverage reporting by using c8 instead of nyc.
275 ## [2.3.5] - 2022-10-21
279 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
280 - Optimize tasks usage lookup implementation.
284 - Fix missed pool event emitter type export.
285 - Fix typedoc documentation generation.
287 ## [2.3.4] - 2022-10-17
291 - Fully automate release process with release-it.
295 - Optimize fair share task scheduling algorithm implementation.
296 - Update benchmarks versus external pools results with latest version.
298 ## [2.3.3] - 2022-10-15
302 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
304 ## [2.3.2] - 2022-10-14
308 - Optimize fair share worker selection strategy implementation.
312 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
314 ## [2.3.1] - 2022-10-13
318 - Pool worker choice strategies:
319 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
320 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
322 ## [2.2.2] - 2022-10-09
326 - Fixed `README.md` file.
328 ## [2.2.1] - 2022-10-08
332 - Dynamic worker choice strategy change at runtime.
334 ## [2.2.0] - 2022-01-05
338 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
340 ## [2.1.0] - 2021-08-29
344 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
348 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
349 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
350 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
351 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
353 ## [2.0.2] - 2021-05-12
357 - Fix `busy` event emission on fixed pool type
359 ## [2.0.1] - 2021-03-16
363 - Check if pool options are properly set.
364 - `busy` event is emitted on all pool types.
366 ## [2.0.0] - 2021-03-01
370 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
374 - `FullPool` event is now renamed to `busy`.
375 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
376 _Find more details on our JSDoc._
378 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
380 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
382 ### Pool options types declaration merge
384 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
386 #### New `export` strategy
390 const DynamicThreadPool = require('poolifier/lib/dynamic')
392 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
395 But you should always prefer just using
398 const { DynamicThreadPool } = require('poolifier')
401 #### New type definitions for input data and response
403 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
404 _This is not a limitation by poolifier but NodeJS._
406 #### Public property replacements
408 `numWorkers` property is now `numberOfWorkers`
410 #### Internal (protected) properties and methods renaming
412 These properties are not intended for end users
414 - `id` => `nextMessageId`
416 These methods are not intended for end users
418 - `_chooseWorker` => `chooseWorker`
419 - `_newWorker` => `createWorker`
420 - `_execute` => `internalExecute`
421 - `_chooseWorker` => `chooseWorker`
422 - `_checkAlive` => `checkAlive`
424 - `_runAsync` => `runAsync`
426 ## [1.1.0] - 2020-05-21
430 - ThreadWorker support async functions as option
431 - Various external library patches
433 ## [1.0.0] - 2020-01-24
437 - FixedThreadPool implementation
438 - DynamicThreadPool implementation
439 - WorkerThread implementation to improve developer experience