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 - Fix message between main worker and worker type definition for tasks.
13 - Fix code documentation.
15 ## [2.4.7] - 2023-04-11
19 - Add worker tasks queue options to pool options.
23 - Fix missing documentation.
25 ## [2.4.6] - 2023-04-10
29 - Ensure one task at a time is executed per worker with tasks queueing enabled.
30 - Properly count worker running tasks with tasks queueing enabled.
32 ## [2.4.5] - 2023-04-09
36 - Use monotonic high resolution timer for worker tasks run time.
37 - Add worker tasks median run time to statistics.
38 - Add worker tasks queue (experimental).
40 ## [2.4.4] - 2023-04-07
44 - Add `PoolEvents` enumeration and `PoolEvent` type.
48 - Destroy worker only on alive check.
50 ## [2.4.3] - 2023-04-07
54 - Fix typedoc generation with inheritance.
56 ## [2.4.2] - 2023-04-06
60 - Add `full` event to dynamic pool.
61 - Keep worker choice strategy in memory for conditional reuse.
65 - Fix possible negative worker key at worker removal in worker choice strategies.
67 ## [2.4.1] - 2023-04-05
71 - Optimize worker choice strategy for dynamic pool.
75 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
77 ## [2.4.0] - 2023-04-04
81 - Add `LESS_BUSY` worker choice strategy.
85 - Optimize worker storage in pool.
86 - Optimize worker alive status check.
87 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
88 - Optimize `LESS_USED` worker choice strategy.
89 - Update benchmarks versus external threads pools.
90 - Optimize tasks usage statistics requirements for worker choice strategy.
94 - Ensure trimmable characters are checked at pool initialization.
95 - Fix message id integer overflow.
96 - Fix pool worker removal in worker choice strategy internals.
97 - Fix package publication with pnpm.
99 ## [2.4.0-3] - 2023-04-04
103 - Add `LESS_BUSY` worker choice strategy.
107 - Optimize worker storage in pool.
108 - Optimize worker alive status check.
109 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
110 - Optimize `LESS_USED` worker choice strategy.
111 - Update benchmarks versus external threads pools.
115 - Ensure trimmable characters are checked at pool initialization.
116 - Fix message id integer overflow.
117 - Fix pool worker removal in worker choice strategy internals.
118 - Fix package publication with pnpm.
120 ## [2.4.0-2] - 2023-04-03
124 - Add `LESS_BUSY` worker choice strategy.
128 - Optimize worker storage in pool.
129 - Optimize worker alive status check.
130 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
131 - Optimize `LESS_USED` worker choice strategy.
135 - Ensure trimmable characters are checked at pool initialization.
136 - Fix message id integer overflow.
137 - Fix pool worker removal in worker choice strategy internals.
138 - Fix package publication with pnpm.
140 ## [2.4.0-1] - 2023-04-03
144 - Add `LESS_BUSY` worker choice strategy.
148 - Optimize worker storage in pool.
149 - Optimize worker alive status check.
150 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
151 - Optimize `LESS_USED` worker choice strategy.
155 - Ensure trimmable characters are checked at pool initialization.
156 - Fix message id integer overflow.
157 - Fix pool worker removal in worker choice strategy internals.
159 ## [2.4.0-0] - 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.3.10] - 2023-03-18
182 - Fix `exports` syntax for ESM and CommonJS.
186 - Permit SemVer pre-release publication.
188 ## [2.3.10-2] - 2023-03-18
192 - Fix `exports` syntax for ESM and CommonJS.
194 ## [2.3.10-1] - 2023-03-18
198 - Permit SemVer pre-release publication.
200 ## [2.3.10-0] - 2023-03-18
204 - Fix `exports` syntax for ESM and CommonJS.
206 ## [2.3.9] - 2023-03-18
210 - Introduce ESM module support along with CommonJS one.
214 - Fix brown paper bag bug referencing the same object literal.
216 ## [2.3.8] - 2023-03-18
220 - Switch internal benchmarking code to benny.
221 - Switch to TypeScript 5.x.x.
222 - Switch rollup bundler plugins to core ones.
223 - Switch to TSDoc syntax.
224 - Enforce conventional commits.
228 - Fix random integer generator.
229 - Fix worker choice strategy pool type identification at initialization.
231 ## [2.3.7] - 2022-10-23
235 - Switch to open collective FOSS project funding platform.
236 - Switch to ts-standard linter configuration on TypeScript code.
240 - Fixed missing async on pool execute method.
241 - Fixed typing in TypeScript example.
242 - Fixed types in unit tests.
244 ## [2.3.6] - 2022-10-22
248 - Cleanup pool attributes and methods.
249 - Refine error types thrown.
253 - Fix continuous integration build on windows.
254 - Fix code coverage reporting by using c8 instead of nyc.
256 ## [2.3.5] - 2022-10-21
260 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
261 - Optimize tasks usage lookup implementation.
265 - Fix missed pool event emitter type export.
266 - Fix typedoc documentation generation.
268 ## [2.3.4] - 2022-10-17
272 - Fully automate release process with release-it.
276 - Optimize fair share task scheduling algorithm implementation.
277 - Update benchmarks versus external pools results with latest version.
279 ## [2.3.3] - 2022-10-15
283 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
285 ## [2.3.2] - 2022-10-14
289 - Optimize fair share worker selection strategy implementation.
293 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
295 ## [2.3.1] - 2022-10-13
299 - Pool worker choice strategies:
300 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
301 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
303 ## [2.2.2] - 2022-10-09
307 - Fixed `README.md` file.
309 ## [2.2.1] - 2022-10-08
313 - Dynamic worker choice strategy change at runtime.
315 ## [2.2.0] - 2022-01-05
319 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
321 ## [2.1.0] - 2021-08-29
325 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
329 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
330 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
331 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
332 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
334 ## [2.0.2] - 2021-05-12
338 - Fix `busy` event emission on fixed pool type
340 ## [2.0.1] - 2021-03-16
344 - Check if pool options are properly set.
345 - `busy` event is emitted on all pool types.
347 ## [2.0.0] - 2021-03-01
351 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
355 - `FullPool` event is now renamed to `busy`.
356 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
357 _Find more details on our JSDoc._
359 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
361 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
363 ### Pool options types declaration merge
365 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
367 #### New `export` strategy
371 const DynamicThreadPool = require('poolifier/lib/dynamic')
373 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
376 But you should always prefer just using
379 const { DynamicThreadPool } = require('poolifier')
382 #### New type definitions for input data and response
384 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
385 _This is not a limitation by poolifier but NodeJS._
387 #### Public property replacements
389 `numWorkers` property is now `numberOfWorkers`
391 #### Internal (protected) properties and methods renaming
393 These properties are not intended for end users
395 - `id` => `nextMessageId`
397 These methods are not intended for end users
399 - `_chooseWorker` => `chooseWorker`
400 - `_newWorker` => `createWorker`
401 - `_execute` => `internalExecute`
402 - `_chooseWorker` => `chooseWorker`
403 - `_checkAlive` => `checkAlive`
405 - `_runAsync` => `runAsync`
407 ## [1.1.0] - 2020-05-21
411 - ThreadWorker support async functions as option
412 - Various external library patches
414 ## [1.0.0] - 2020-01-24
418 - FixedThreadPool implementation
419 - DynamicThreadPool implementation
420 - WorkerThread implementation to improve developer experience