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.6] - 2023-04-10
14 - Ensure one task at a time is executed per worker with tasks queueing enabled.
15 - Properly count worker running tasks with tasks queueing enabled.
17 ## [2.4.5] - 2023-04-09
21 - Use monotonic high resolution timer for worker tasks run time.
22 - Add worker tasks median run time to statistics.
23 - Add worker tasks queue (experimental).
25 ## [2.4.4] - 2023-04-07
29 - Add `PoolEvents` enumeration and `PoolEvent` type.
33 - Destroy worker only on alive check.
35 ## [2.4.3] - 2023-04-07
39 - Fix typedoc generation with inheritance.
41 ## [2.4.2] - 2023-04-06
45 - Add `full` event to dynamic pool.
46 - Keep worker choice strategy in memory for conditional reuse.
50 - Fix possible negative worker key at worker removal in worker choice strategies.
52 ## [2.4.1] - 2023-04-05
56 - Optimize worker choice strategy for dynamic pool.
60 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
62 ## [2.4.0] - 2023-04-04
66 - Add `LESS_BUSY` worker choice strategy.
70 - Optimize worker storage in pool.
71 - Optimize worker alive status check.
72 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
73 - Optimize `LESS_USED` worker choice strategy.
74 - Update benchmarks versus external threads pools.
75 - Optimize tasks usage statistics requirements for worker choice strategy.
79 - Ensure trimmable characters are checked at pool initialization.
80 - Fix message id integer overflow.
81 - Fix pool worker removal in worker choice strategy internals.
82 - Fix package publication with pnpm.
84 ## [2.4.0-3] - 2023-04-04
88 - Add `LESS_BUSY` worker choice strategy.
92 - Optimize worker storage in pool.
93 - Optimize worker alive status check.
94 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
95 - Optimize `LESS_USED` worker choice strategy.
96 - Update benchmarks versus external threads pools.
100 - Ensure trimmable characters are checked at pool initialization.
101 - Fix message id integer overflow.
102 - Fix pool worker removal in worker choice strategy internals.
103 - Fix package publication with pnpm.
105 ## [2.4.0-2] - 2023-04-03
109 - Add `LESS_BUSY` worker choice strategy.
113 - Optimize worker storage in pool.
114 - Optimize worker alive status check.
115 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
116 - Optimize `LESS_USED` worker choice strategy.
120 - Ensure trimmable characters are checked at pool initialization.
121 - Fix message id integer overflow.
122 - Fix pool worker removal in worker choice strategy internals.
123 - Fix package publication with pnpm.
125 ## [2.4.0-1] - 2023-04-03
129 - Add `LESS_BUSY` worker choice strategy.
133 - Optimize worker storage in pool.
134 - Optimize worker alive status check.
135 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
136 - Optimize `LESS_USED` worker choice strategy.
140 - Ensure trimmable characters are checked at pool initialization.
141 - Fix message id integer overflow.
142 - Fix pool worker removal in worker choice strategy internals.
144 ## [2.4.0-0] - 2023-04-03
148 - Add `LESS_BUSY` worker choice strategy.
152 - Optimize worker storage in pool.
153 - Optimize worker alive status check.
154 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
155 - Optimize `LESS_USED` worker choice strategy.
159 - Ensure trimmable characters are checked at pool initialization.
160 - Fix message id integer overflow.
161 - Fix pool worker removal in worker choice strategy internals.
163 ## [2.3.10] - 2023-03-18
167 - Fix `exports` syntax for ESM and CommonJS.
171 - Permit SemVer pre-release publication.
173 ## [2.3.10-2] - 2023-03-18
177 - Fix `exports` syntax for ESM and CommonJS.
179 ## [2.3.10-1] - 2023-03-18
183 - Permit SemVer pre-release publication.
185 ## [2.3.10-0] - 2023-03-18
189 - Fix `exports` syntax for ESM and CommonJS.
191 ## [2.3.9] - 2023-03-18
195 - Introduce ESM module support along with CommonJS one.
199 - Fix brown paper bag bug referencing the same object literal.
201 ## [2.3.8] - 2023-03-18
205 - Switch internal benchmarking code to benny.
206 - Switch to TypeScript 5.x.x.
207 - Switch rollup bundler plugins to core ones.
208 - Switch to TSDoc syntax.
209 - Enforce conventional commits.
213 - Fix random integer generator.
214 - Fix worker choice strategy pool type identification at initialization.
216 ## [2.3.7] - 2022-10-23
220 - Switch to open collective FOSS project funding platform.
221 - Switch to ts-standard linter configuration on TypeScript code.
225 - Fixed missing async on pool execute method.
226 - Fixed typing in TypeScript example.
227 - Fixed types in unit tests.
229 ## [2.3.6] - 2022-10-22
233 - Cleanup pool attributes and methods.
234 - Refine error types thrown.
238 - Fix continuous integration build on windows.
239 - Fix code coverage reporting by using c8 instead of nyc.
241 ## [2.3.5] - 2022-10-21
245 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
246 - Optimize tasks usage lookup implementation.
250 - Fix missed pool event emitter type export.
251 - Fix typedoc documentation generation.
253 ## [2.3.4] - 2022-10-17
257 - Fully automate release process with release-it.
261 - Optimize fair share task scheduling algorithm implementation.
262 - Update benchmarks versus external pools results with latest version.
264 ## [2.3.3] - 2022-10-15
268 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
270 ## [2.3.2] - 2022-10-14
274 - Optimize fair share worker selection strategy implementation.
278 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
280 ## [2.3.1] - 2022-10-13
284 - Pool worker choice strategies:
285 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
286 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
288 ## [2.2.2] - 2022-10-09
292 - Fixed `README.md` file.
294 ## [2.2.1] - 2022-10-08
298 - Dynamic worker choice strategy change at runtime.
300 ## [2.2.0] - 2022-01-05
304 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
306 ## [2.1.0] - 2021-08-29
310 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
314 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
315 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
316 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
317 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
319 ## [2.0.2] - 2021-05-12
323 - Fix `busy` event emission on fixed pool type
325 ## [2.0.1] - 2021-03-16
329 - Check if pool options are properly set.
330 - `busy` event is emitted on all pool types.
332 ## [2.0.0] - 2021-03-01
336 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
340 - `FullPool` event is now renamed to `busy`.
341 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
342 _Find more details on our JSDoc._
344 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
346 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
348 ### Pool options types declaration merge
350 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
352 #### New `export` strategy
356 const DynamicThreadPool = require('poolifier/lib/dynamic')
358 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
361 But you should always prefer just using
364 const { DynamicThreadPool } = require('poolifier')
367 #### New type definitions for input data and response
369 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
370 _This is not a limitation by poolifier but NodeJS._
372 #### Public property replacements
374 `numWorkers` property is now `numberOfWorkers`
376 #### Internal (protected) properties and methods renaming
378 These properties are not intended for end users
380 - `id` => `nextMessageId`
382 These methods are not intended for end users
384 - `_chooseWorker` => `chooseWorker`
385 - `_newWorker` => `createWorker`
386 - `_execute` => `internalExecute`
387 - `_chooseWorker` => `chooseWorker`
388 - `_checkAlive` => `checkAlive`
390 - `_runAsync` => `runAsync`
392 ## [1.1.0] - 2020-05-21
396 - ThreadWorker support async functions as option
397 - Various external library patches
399 ## [1.0.0] - 2020-01-24
403 - FixedThreadPool implementation
404 - DynamicThreadPool implementation
405 - WorkerThread implementation to improve developer experience