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.7] - 2023-04-11
14 - Add worker tasks queue options to pool options.
18 - Fix missing documentation.
20 ## [2.4.6] - 2023-04-10
24 - Ensure one task at a time is executed per worker with tasks queueing enabled.
25 - Properly count worker running tasks with tasks queueing enabled.
27 ## [2.4.5] - 2023-04-09
31 - Use monotonic high resolution timer for worker tasks run time.
32 - Add worker tasks median run time to statistics.
33 - Add worker tasks queue (experimental).
35 ## [2.4.4] - 2023-04-07
39 - Add `PoolEvents` enumeration and `PoolEvent` type.
43 - Destroy worker only on alive check.
45 ## [2.4.3] - 2023-04-07
49 - Fix typedoc generation with inheritance.
51 ## [2.4.2] - 2023-04-06
55 - Add `full` event to dynamic pool.
56 - Keep worker choice strategy in memory for conditional reuse.
60 - Fix possible negative worker key at worker removal in worker choice strategies.
62 ## [2.4.1] - 2023-04-05
66 - Optimize worker choice strategy for dynamic pool.
70 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
72 ## [2.4.0] - 2023-04-04
76 - Add `LESS_BUSY` worker choice strategy.
80 - Optimize worker storage in pool.
81 - Optimize worker alive status check.
82 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
83 - Optimize `LESS_USED` worker choice strategy.
84 - Update benchmarks versus external threads pools.
85 - Optimize tasks usage statistics requirements for worker choice strategy.
89 - Ensure trimmable characters are checked at pool initialization.
90 - Fix message id integer overflow.
91 - Fix pool worker removal in worker choice strategy internals.
92 - Fix package publication with pnpm.
94 ## [2.4.0-3] - 2023-04-04
98 - Add `LESS_BUSY` worker choice strategy.
102 - Optimize worker storage in pool.
103 - Optimize worker alive status check.
104 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
105 - Optimize `LESS_USED` worker choice strategy.
106 - Update benchmarks versus external threads pools.
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-2] - 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.
133 - Fix package publication with pnpm.
135 ## [2.4.0-1] - 2023-04-03
139 - Add `LESS_BUSY` worker choice strategy.
143 - Optimize worker storage in pool.
144 - Optimize worker alive status check.
145 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
146 - Optimize `LESS_USED` worker choice strategy.
150 - Ensure trimmable characters are checked at pool initialization.
151 - Fix message id integer overflow.
152 - Fix pool worker removal in worker choice strategy internals.
154 ## [2.4.0-0] - 2023-04-03
158 - Add `LESS_BUSY` worker choice strategy.
162 - Optimize worker storage in pool.
163 - Optimize worker alive status check.
164 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
165 - Optimize `LESS_USED` worker choice strategy.
169 - Ensure trimmable characters are checked at pool initialization.
170 - Fix message id integer overflow.
171 - Fix pool worker removal in worker choice strategy internals.
173 ## [2.3.10] - 2023-03-18
177 - Fix `exports` syntax for ESM and CommonJS.
181 - Permit SemVer pre-release publication.
183 ## [2.3.10-2] - 2023-03-18
187 - Fix `exports` syntax for ESM and CommonJS.
189 ## [2.3.10-1] - 2023-03-18
193 - Permit SemVer pre-release publication.
195 ## [2.3.10-0] - 2023-03-18
199 - Fix `exports` syntax for ESM and CommonJS.
201 ## [2.3.9] - 2023-03-18
205 - Introduce ESM module support along with CommonJS one.
209 - Fix brown paper bag bug referencing the same object literal.
211 ## [2.3.8] - 2023-03-18
215 - Switch internal benchmarking code to benny.
216 - Switch to TypeScript 5.x.x.
217 - Switch rollup bundler plugins to core ones.
218 - Switch to TSDoc syntax.
219 - Enforce conventional commits.
223 - Fix random integer generator.
224 - Fix worker choice strategy pool type identification at initialization.
226 ## [2.3.7] - 2022-10-23
230 - Switch to open collective FOSS project funding platform.
231 - Switch to ts-standard linter configuration on TypeScript code.
235 - Fixed missing async on pool execute method.
236 - Fixed typing in TypeScript example.
237 - Fixed types in unit tests.
239 ## [2.3.6] - 2022-10-22
243 - Cleanup pool attributes and methods.
244 - Refine error types thrown.
248 - Fix continuous integration build on windows.
249 - Fix code coverage reporting by using c8 instead of nyc.
251 ## [2.3.5] - 2022-10-21
255 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
256 - Optimize tasks usage lookup implementation.
260 - Fix missed pool event emitter type export.
261 - Fix typedoc documentation generation.
263 ## [2.3.4] - 2022-10-17
267 - Fully automate release process with release-it.
271 - Optimize fair share task scheduling algorithm implementation.
272 - Update benchmarks versus external pools results with latest version.
274 ## [2.3.3] - 2022-10-15
278 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
280 ## [2.3.2] - 2022-10-14
284 - Optimize fair share worker selection strategy implementation.
288 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
290 ## [2.3.1] - 2022-10-13
294 - Pool worker choice strategies:
295 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
296 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
298 ## [2.2.2] - 2022-10-09
302 - Fixed `README.md` file.
304 ## [2.2.1] - 2022-10-08
308 - Dynamic worker choice strategy change at runtime.
310 ## [2.2.0] - 2022-01-05
314 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
316 ## [2.1.0] - 2021-08-29
320 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
324 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
325 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
326 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
327 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
329 ## [2.0.2] - 2021-05-12
333 - Fix `busy` event emission on fixed pool type
335 ## [2.0.1] - 2021-03-16
339 - Check if pool options are properly set.
340 - `busy` event is emitted on all pool types.
342 ## [2.0.0] - 2021-03-01
346 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
350 - `FullPool` event is now renamed to `busy`.
351 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
352 _Find more details on our JSDoc._
354 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
356 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
358 ### Pool options types declaration merge
360 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
362 #### New `export` strategy
366 const DynamicThreadPool = require('poolifier/lib/dynamic')
368 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
371 But you should always prefer just using
374 const { DynamicThreadPool } = require('poolifier')
377 #### New type definitions for input data and response
379 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
380 _This is not a limitation by poolifier but NodeJS._
382 #### Public property replacements
384 `numWorkers` property is now `numberOfWorkers`
386 #### Internal (protected) properties and methods renaming
388 These properties are not intended for end users
390 - `id` => `nextMessageId`
392 These methods are not intended for end users
394 - `_chooseWorker` => `chooseWorker`
395 - `_newWorker` => `createWorker`
396 - `_execute` => `internalExecute`
397 - `_chooseWorker` => `chooseWorker`
398 - `_checkAlive` => `checkAlive`
400 - `_runAsync` => `runAsync`
402 ## [1.1.0] - 2020-05-21
406 - ThreadWorker support async functions as option
407 - Various external library patches
409 ## [1.0.0] - 2020-01-24
413 - FixedThreadPool implementation
414 - DynamicThreadPool implementation
415 - WorkerThread implementation to improve developer experience