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 - Support multiple task functions per worker.
13 - Add custom worker weights support to worker choice strategies options.
17 - Use O(1) queue implementation for tasks queueing.
21 - Fix median computation implementation.
22 - Fix fair share worker choice strategy internals update.
24 ## [2.4.11] - 2023-04-23
28 - Optimize free worker finding in worker choice strategies.
30 ## [2.4.10] - 2023-04-15
34 - Fix typescript type definition for worker function: ensure the input data is optional.
35 - Fix typescript type definition for pool execute(): ensure the input data is optional.
37 ## [2.4.9] - 2023-04-15
41 - Add tasks queue enablement runtime setter to pool.
42 - Add tasks queue options runtime setter to pool.
43 - Add worker choice strategy options runtime setter to pool.
47 - Remove the tasks queuing experimental status.
51 - Fix worker function type definition and validation.
52 - Fix worker choice strategy options handling.
54 ## [2.4.8] - 2023-04-12
58 - Fix message between main worker and worker type definition for tasks.
59 - Fix code documentation.
61 ## [2.4.7] - 2023-04-11
65 - Add worker tasks queue options to pool options.
69 - Fix missing documentation.
71 ## [2.4.6] - 2023-04-10
75 - Ensure one task at a time is executed per worker with tasks queueing enabled.
76 - Properly count worker running tasks with tasks queueing enabled.
78 ## [2.4.5] - 2023-04-09
82 - Use monotonic high resolution timer for worker tasks run time.
83 - Add worker tasks median run time to statistics.
84 - Add worker tasks queue (experimental).
86 ## [2.4.4] - 2023-04-07
90 - Add `PoolEvents` enumeration and `PoolEvent` type.
94 - Destroy worker only on alive check.
96 ## [2.4.3] - 2023-04-07
100 - Fix typedoc generation with inheritance.
102 ## [2.4.2] - 2023-04-06
106 - Add `full` event to dynamic pool.
107 - Keep worker choice strategy in memory for conditional reuse.
111 - Fix possible negative worker key at worker removal in worker choice strategies.
113 ## [2.4.1] - 2023-04-05
117 - Optimize worker choice strategy for dynamic pool.
121 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
123 ## [2.4.0] - 2023-04-04
127 - Add `LESS_BUSY` worker choice strategy.
131 - Optimize worker storage in pool.
132 - Optimize worker alive status check.
133 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
134 - Optimize `LESS_USED` worker choice strategy.
135 - Update benchmarks versus external threads pools.
136 - Optimize tasks usage statistics requirements for 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.
143 - Fix package publication with pnpm.
145 ## [2.4.0-3] - 2023-04-04
149 - Add `LESS_BUSY` worker choice strategy.
153 - Optimize worker storage in pool.
154 - Optimize worker alive status check.
155 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
156 - Optimize `LESS_USED` worker choice strategy.
157 - Update benchmarks versus external threads pools.
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-2] - 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.
184 - Fix package publication with pnpm.
186 ## [2.4.0-1] - 2023-04-03
190 - Add `LESS_BUSY` worker choice strategy.
194 - Optimize worker storage in pool.
195 - Optimize worker alive status check.
196 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
197 - Optimize `LESS_USED` worker choice strategy.
201 - Ensure trimmable characters are checked at pool initialization.
202 - Fix message id integer overflow.
203 - Fix pool worker removal in worker choice strategy internals.
205 ## [2.4.0-0] - 2023-04-03
209 - Add `LESS_BUSY` worker choice strategy.
213 - Optimize worker storage in pool.
214 - Optimize worker alive status check.
215 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
216 - Optimize `LESS_USED` worker choice strategy.
220 - Ensure trimmable characters are checked at pool initialization.
221 - Fix message id integer overflow.
222 - Fix pool worker removal in worker choice strategy internals.
224 ## [2.3.10] - 2023-03-18
228 - Fix `exports` syntax for ESM and CommonJS.
232 - Permit SemVer pre-release publication.
234 ## [2.3.10-2] - 2023-03-18
238 - Fix `exports` syntax for ESM and CommonJS.
240 ## [2.3.10-1] - 2023-03-18
244 - Permit SemVer pre-release publication.
246 ## [2.3.10-0] - 2023-03-18
250 - Fix `exports` syntax for ESM and CommonJS.
252 ## [2.3.9] - 2023-03-18
256 - Introduce ESM module support along with CommonJS one.
260 - Fix brown paper bag bug referencing the same object literal.
262 ## [2.3.8] - 2023-03-18
266 - Switch internal benchmarking code to benny.
267 - Switch to TypeScript 5.x.x.
268 - Switch rollup bundler plugins to core ones.
269 - Switch to TSDoc syntax.
270 - Enforce conventional commits.
274 - Fix random integer generator.
275 - Fix worker choice strategy pool type identification at initialization.
277 ## [2.3.7] - 2022-10-23
281 - Switch to open collective FOSS project funding platform.
282 - Switch to ts-standard linter configuration on TypeScript code.
286 - Fixed missing async on pool execute method.
287 - Fixed typing in TypeScript example.
288 - Fixed types in unit tests.
290 ## [2.3.6] - 2022-10-22
294 - Cleanup pool attributes and methods.
295 - Refine error types thrown.
299 - Fix continuous integration build on windows.
300 - Fix code coverage reporting by using c8 instead of nyc.
302 ## [2.3.5] - 2022-10-21
306 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
307 - Optimize tasks usage lookup implementation.
311 - Fix missed pool event emitter type export.
312 - Fix typedoc documentation generation.
314 ## [2.3.4] - 2022-10-17
318 - Fully automate release process with release-it.
322 - Optimize fair share task scheduling algorithm implementation.
323 - Update benchmarks versus external pools results with latest version.
325 ## [2.3.3] - 2022-10-15
329 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
331 ## [2.3.2] - 2022-10-14
335 - Optimize fair share worker selection strategy implementation.
339 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
341 ## [2.3.1] - 2022-10-13
345 - Pool worker choice strategies:
346 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
347 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
349 ## [2.2.2] - 2022-10-09
353 - Fixed `README.md` file.
355 ## [2.2.1] - 2022-10-08
359 - Dynamic worker choice strategy change at runtime.
361 ## [2.2.0] - 2022-01-05
365 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
367 ## [2.1.0] - 2021-08-29
371 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
375 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
376 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
377 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
378 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
380 ## [2.0.2] - 2021-05-12
384 - Fix `busy` event emission on fixed pool type
386 ## [2.0.1] - 2021-03-16
390 - Check if pool options are properly set.
391 - `busy` event is emitted on all pool types.
393 ## [2.0.0] - 2021-03-01
397 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
401 - `FullPool` event is now renamed to `busy`.
402 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
403 _Find more details on our JSDoc._
405 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
407 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
409 ### Pool options types declaration merge
411 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
413 #### New `export` strategy
417 const DynamicThreadPool = require('poolifier/lib/dynamic')
419 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
422 But you should always prefer just using
425 const { DynamicThreadPool } = require('poolifier')
428 #### New type definitions for input data and response
430 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
431 _This is not a limitation by poolifier but NodeJS._
433 #### Public property replacements
435 `numWorkers` property is now `numberOfWorkers`
437 #### Internal (protected) properties and methods renaming
439 These properties are not intended for end users
441 - `id` => `nextMessageId`
443 These methods are not intended for end users
445 - `_chooseWorker` => `chooseWorker`
446 - `_newWorker` => `createWorker`
447 - `_execute` => `internalExecute`
448 - `_chooseWorker` => `chooseWorker`
449 - `_checkAlive` => `checkAlive`
451 - `_runAsync` => `runAsync`
453 ## [1.1.0] - 2020-05-21
457 - ThreadWorker support async functions as option
458 - Various external library patches
460 ## [1.0.0] - 2020-01-24
464 - FixedThreadPool implementation
465 - DynamicThreadPool implementation
466 - WorkerThread implementation to improve developer experience