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 - Ensure one task at a time is executed per worker with tasks queueing enabled.
14 ## [2.4.5] - 2023-04-09
18 - Use monotonic high resolution timer for worker tasks run time.
19 - Add worker tasks median run time to statistics.
20 - Add worker tasks queue (experimental).
22 ## [2.4.4] - 2023-04-07
26 - Add `PoolEvents` enumeration and `PoolEvent` type.
30 - Destroy worker only on alive check.
32 ## [2.4.3] - 2023-04-07
36 - Fix typedoc generation with inheritance.
38 ## [2.4.2] - 2023-04-06
42 - Add `full` event to dynamic pool.
43 - Keep worker choice strategy in memory for conditional reuse.
47 - Fix possible negative worker key at worker removal in worker choice strategies.
49 ## [2.4.1] - 2023-04-05
53 - Optimize worker choice strategy for dynamic pool.
57 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
59 ## [2.4.0] - 2023-04-04
63 - Add `LESS_BUSY` worker choice strategy.
67 - Optimize worker storage in pool.
68 - Optimize worker alive status check.
69 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
70 - Optimize `LESS_USED` worker choice strategy.
71 - Update benchmarks versus external threads pools.
72 - Optimize tasks usage statistics requirements for worker choice strategy.
76 - Ensure trimmable characters are checked at pool initialization.
77 - Fix message id integer overflow.
78 - Fix pool worker removal in worker choice strategy internals.
79 - Fix package publication with pnpm.
81 ## [2.4.0-3] - 2023-04-04
85 - Add `LESS_BUSY` worker choice strategy.
89 - Optimize worker storage in pool.
90 - Optimize worker alive status check.
91 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
92 - Optimize `LESS_USED` worker choice strategy.
93 - Update benchmarks versus external threads pools.
97 - Ensure trimmable characters are checked at pool initialization.
98 - Fix message id integer overflow.
99 - Fix pool worker removal in worker choice strategy internals.
100 - Fix package publication with pnpm.
102 ## [2.4.0-2] - 2023-04-03
106 - Add `LESS_BUSY` worker choice strategy.
110 - Optimize worker storage in pool.
111 - Optimize worker alive status check.
112 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
113 - Optimize `LESS_USED` worker choice strategy.
117 - Ensure trimmable characters are checked at pool initialization.
118 - Fix message id integer overflow.
119 - Fix pool worker removal in worker choice strategy internals.
120 - Fix package publication with pnpm.
122 ## [2.4.0-1] - 2023-04-03
126 - Add `LESS_BUSY` worker choice strategy.
130 - Optimize worker storage in pool.
131 - Optimize worker alive status check.
132 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
133 - Optimize `LESS_USED` worker choice strategy.
137 - Ensure trimmable characters are checked at pool initialization.
138 - Fix message id integer overflow.
139 - Fix pool worker removal in worker choice strategy internals.
141 ## [2.4.0-0] - 2023-04-03
145 - Add `LESS_BUSY` worker choice strategy.
149 - Optimize worker storage in pool.
150 - Optimize worker alive status check.
151 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
152 - Optimize `LESS_USED` worker choice strategy.
156 - Ensure trimmable characters are checked at pool initialization.
157 - Fix message id integer overflow.
158 - Fix pool worker removal in worker choice strategy internals.
160 ## [2.3.10] - 2023-03-18
164 - Fix `exports` syntax for ESM and CommonJS.
168 - Permit SemVer pre-release publication.
170 ## [2.3.10-2] - 2023-03-18
174 - Fix `exports` syntax for ESM and CommonJS.
176 ## [2.3.10-1] - 2023-03-18
180 - Permit SemVer pre-release publication.
182 ## [2.3.10-0] - 2023-03-18
186 - Fix `exports` syntax for ESM and CommonJS.
188 ## [2.3.9] - 2023-03-18
192 - Introduce ESM module support along with CommonJS one.
196 - Fix brown paper bag bug referencing the same object literal.
198 ## [2.3.8] - 2023-03-18
202 - Switch internal benchmarking code to benny.
203 - Switch to TypeScript 5.x.x.
204 - Switch rollup bundler plugins to core ones.
205 - Switch to TSDoc syntax.
206 - Enforce conventional commits.
210 - Fix random integer generator.
211 - Fix worker choice strategy pool type identification at initialization.
213 ## [2.3.7] - 2022-10-23
217 - Switch to open collective FOSS project funding platform.
218 - Switch to ts-standard linter configuration on TypeScript code.
222 - Fixed missing async on pool execute method.
223 - Fixed typing in TypeScript example.
224 - Fixed types in unit tests.
226 ## [2.3.6] - 2022-10-22
230 - Cleanup pool attributes and methods.
231 - Refine error types thrown.
235 - Fix continuous integration build on windows.
236 - Fix code coverage reporting by using c8 instead of nyc.
238 ## [2.3.5] - 2022-10-21
242 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
243 - Optimize tasks usage lookup implementation.
247 - Fix missed pool event emitter type export.
248 - Fix typedoc documentation generation.
250 ## [2.3.4] - 2022-10-17
254 - Fully automate release process with release-it.
258 - Optimize fair share task scheduling algorithm implementation.
259 - Update benchmarks versus external pools results with latest version.
261 ## [2.3.3] - 2022-10-15
265 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
267 ## [2.3.2] - 2022-10-14
271 - Optimize fair share worker selection strategy implementation.
275 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
277 ## [2.3.1] - 2022-10-13
281 - Pool worker choice strategies:
282 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
283 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
285 ## [2.2.2] - 2022-10-09
289 - Fixed `README.md` file.
291 ## [2.2.1] - 2022-10-08
295 - Dynamic worker choice strategy change at runtime.
297 ## [2.2.0] - 2022-01-05
301 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
303 ## [2.1.0] - 2021-08-29
307 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
311 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
312 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
313 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
314 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
316 ## [2.0.2] - 2021-05-12
320 - Fix `busy` event emission on fixed pool type
322 ## [2.0.1] - 2021-03-16
326 - Check if pool options are properly set.
327 - `busy` event is emitted on all pool types.
329 ## [2.0.0] - 2021-03-01
333 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
337 - `FullPool` event is now renamed to `busy`.
338 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
339 _Find more details on our JSDoc._
341 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
343 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
345 ### Pool options types declaration merge
347 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
349 #### New `export` strategy
353 const DynamicThreadPool = require('poolifier/lib/dynamic')
355 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
358 But you should always prefer just using
361 const { DynamicThreadPool } = require('poolifier')
364 #### New type definitions for input data and response
366 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
367 _This is not a limitation by poolifier but NodeJS._
369 #### Public property replacements
371 `numWorkers` property is now `numberOfWorkers`
373 #### Internal (protected) properties and methods renaming
375 These properties are not intended for end users
377 - `id` => `nextMessageId`
379 These methods are not intended for end users
381 - `_chooseWorker` => `chooseWorker`
382 - `_newWorker` => `createWorker`
383 - `_execute` => `internalExecute`
384 - `_chooseWorker` => `chooseWorker`
385 - `_checkAlive` => `checkAlive`
387 - `_runAsync` => `runAsync`
389 ## [1.1.0] - 2020-05-21
393 - ThreadWorker support async functions as option
394 - Various external library patches
396 ## [1.0.0] - 2020-01-24
400 - FixedThreadPool implementation
401 - DynamicThreadPool implementation
402 - WorkerThread implementation to improve developer experience