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.10] - 2023-04-15
14 - Fix typescript type definition for worker function: ensure the input data is optional.
15 - Fix typescript type definition for pool execute(): ensure the input data is optional.
17 ## [2.4.9] - 2023-04-15
21 - Add tasks queue enablement runtime setter to pool.
22 - Add tasks queue options runtime setter to pool.
23 - Add worker choice strategy options runtime setter to pool.
27 - Remove the tasks queuing experimental status.
31 - Fix worker function type definition and validation.
32 - Fix worker choice strategy options handling.
34 ## [2.4.8] - 2023-04-12
38 - Fix message between main worker and worker type definition for tasks.
39 - Fix code documentation.
41 ## [2.4.7] - 2023-04-11
45 - Add worker tasks queue options to pool options.
49 - Fix missing documentation.
51 ## [2.4.6] - 2023-04-10
55 - Ensure one task at a time is executed per worker with tasks queueing enabled.
56 - Properly count worker running tasks with tasks queueing enabled.
58 ## [2.4.5] - 2023-04-09
62 - Use monotonic high resolution timer for worker tasks run time.
63 - Add worker tasks median run time to statistics.
64 - Add worker tasks queue (experimental).
66 ## [2.4.4] - 2023-04-07
70 - Add `PoolEvents` enumeration and `PoolEvent` type.
74 - Destroy worker only on alive check.
76 ## [2.4.3] - 2023-04-07
80 - Fix typedoc generation with inheritance.
82 ## [2.4.2] - 2023-04-06
86 - Add `full` event to dynamic pool.
87 - Keep worker choice strategy in memory for conditional reuse.
91 - Fix possible negative worker key at worker removal in worker choice strategies.
93 ## [2.4.1] - 2023-04-05
97 - Optimize worker choice strategy for dynamic pool.
101 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
103 ## [2.4.0] - 2023-04-04
107 - Add `LESS_BUSY` worker choice strategy.
111 - Optimize worker storage in pool.
112 - Optimize worker alive status check.
113 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
114 - Optimize `LESS_USED` worker choice strategy.
115 - Update benchmarks versus external threads pools.
116 - Optimize tasks usage statistics requirements for 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-3] - 2023-04-04
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.
137 - Update benchmarks versus external threads pools.
141 - Ensure trimmable characters are checked at pool initialization.
142 - Fix message id integer overflow.
143 - Fix pool worker removal in worker choice strategy internals.
144 - Fix package publication with pnpm.
146 ## [2.4.0-2] - 2023-04-03
150 - Add `LESS_BUSY` worker choice strategy.
154 - Optimize worker storage in pool.
155 - Optimize worker alive status check.
156 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
157 - Optimize `LESS_USED` worker choice strategy.
161 - Ensure trimmable characters are checked at pool initialization.
162 - Fix message id integer overflow.
163 - Fix pool worker removal in worker choice strategy internals.
164 - Fix package publication with pnpm.
166 ## [2.4.0-1] - 2023-04-03
170 - Add `LESS_BUSY` worker choice strategy.
174 - Optimize worker storage in pool.
175 - Optimize worker alive status check.
176 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
177 - Optimize `LESS_USED` worker choice strategy.
181 - Ensure trimmable characters are checked at pool initialization.
182 - Fix message id integer overflow.
183 - Fix pool worker removal in worker choice strategy internals.
185 ## [2.4.0-0] - 2023-04-03
189 - Add `LESS_BUSY` worker choice strategy.
193 - Optimize worker storage in pool.
194 - Optimize worker alive status check.
195 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
196 - Optimize `LESS_USED` worker choice strategy.
200 - Ensure trimmable characters are checked at pool initialization.
201 - Fix message id integer overflow.
202 - Fix pool worker removal in worker choice strategy internals.
204 ## [2.3.10] - 2023-03-18
208 - Fix `exports` syntax for ESM and CommonJS.
212 - Permit SemVer pre-release publication.
214 ## [2.3.10-2] - 2023-03-18
218 - Fix `exports` syntax for ESM and CommonJS.
220 ## [2.3.10-1] - 2023-03-18
224 - Permit SemVer pre-release publication.
226 ## [2.3.10-0] - 2023-03-18
230 - Fix `exports` syntax for ESM and CommonJS.
232 ## [2.3.9] - 2023-03-18
236 - Introduce ESM module support along with CommonJS one.
240 - Fix brown paper bag bug referencing the same object literal.
242 ## [2.3.8] - 2023-03-18
246 - Switch internal benchmarking code to benny.
247 - Switch to TypeScript 5.x.x.
248 - Switch rollup bundler plugins to core ones.
249 - Switch to TSDoc syntax.
250 - Enforce conventional commits.
254 - Fix random integer generator.
255 - Fix worker choice strategy pool type identification at initialization.
257 ## [2.3.7] - 2022-10-23
261 - Switch to open collective FOSS project funding platform.
262 - Switch to ts-standard linter configuration on TypeScript code.
266 - Fixed missing async on pool execute method.
267 - Fixed typing in TypeScript example.
268 - Fixed types in unit tests.
270 ## [2.3.6] - 2022-10-22
274 - Cleanup pool attributes and methods.
275 - Refine error types thrown.
279 - Fix continuous integration build on windows.
280 - Fix code coverage reporting by using c8 instead of nyc.
282 ## [2.3.5] - 2022-10-21
286 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
287 - Optimize tasks usage lookup implementation.
291 - Fix missed pool event emitter type export.
292 - Fix typedoc documentation generation.
294 ## [2.3.4] - 2022-10-17
298 - Fully automate release process with release-it.
302 - Optimize fair share task scheduling algorithm implementation.
303 - Update benchmarks versus external pools results with latest version.
305 ## [2.3.3] - 2022-10-15
309 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
311 ## [2.3.2] - 2022-10-14
315 - Optimize fair share worker selection strategy implementation.
319 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
321 ## [2.3.1] - 2022-10-13
325 - Pool worker choice strategies:
326 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
327 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
329 ## [2.2.2] - 2022-10-09
333 - Fixed `README.md` file.
335 ## [2.2.1] - 2022-10-08
339 - Dynamic worker choice strategy change at runtime.
341 ## [2.2.0] - 2022-01-05
345 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
347 ## [2.1.0] - 2021-08-29
351 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
355 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
356 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
357 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
358 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
360 ## [2.0.2] - 2021-05-12
364 - Fix `busy` event emission on fixed pool type
366 ## [2.0.1] - 2021-03-16
370 - Check if pool options are properly set.
371 - `busy` event is emitted on all pool types.
373 ## [2.0.0] - 2021-03-01
377 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
381 - `FullPool` event is now renamed to `busy`.
382 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
383 _Find more details on our JSDoc._
385 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
387 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
389 ### Pool options types declaration merge
391 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
393 #### New `export` strategy
397 const DynamicThreadPool = require('poolifier/lib/dynamic')
399 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
402 But you should always prefer just using
405 const { DynamicThreadPool } = require('poolifier')
408 #### New type definitions for input data and response
410 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
411 _This is not a limitation by poolifier but NodeJS._
413 #### Public property replacements
415 `numWorkers` property is now `numberOfWorkers`
417 #### Internal (protected) properties and methods renaming
419 These properties are not intended for end users
421 - `id` => `nextMessageId`
423 These methods are not intended for end users
425 - `_chooseWorker` => `chooseWorker`
426 - `_newWorker` => `createWorker`
427 - `_execute` => `internalExecute`
428 - `_chooseWorker` => `chooseWorker`
429 - `_checkAlive` => `checkAlive`
431 - `_runAsync` => `runAsync`
433 ## [1.1.0] - 2020-05-21
437 - ThreadWorker support async functions as option
438 - Various external library patches
440 ## [1.0.0] - 2020-01-24
444 - FixedThreadPool implementation
445 - DynamicThreadPool implementation
446 - WorkerThread implementation to improve developer experience