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.5.0] - 2023-05-31
14 - Switch pool event emitter to `EventEmitterAsyncResource`.
15 - Add tasks wait time accounting in per worker tasks usage.
16 - Add interleaved weighted round robin worker choice strategy (experimental).
20 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
22 ## [2.4.14] - 2023-05-09
26 - Ensure no undefined task runtime can land in the tasks history.
27 - Fix median computation implementation once again.
31 - Unit tests for median and queue implementations.
33 ## [2.4.13] - 2023-05-08
37 - Fix worker choice strategy options validation.
38 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
40 ## [2.4.12] - 2023-05-06
44 - Support multiple task functions per worker.
45 - Add custom worker weights support to worker choice strategies options.
49 - Use O(1) queue implementation for tasks queueing.
53 - Fix median computation implementation.
54 - Fix fair share worker choice strategy internals update.
56 ## [2.4.11] - 2023-04-23
60 - Optimize free worker finding in worker choice strategies.
62 ## [2.4.10] - 2023-04-15
66 - Fix typescript type definition for worker function: ensure the input data is optional.
67 - Fix typescript type definition for pool execute(): ensure the input data is optional.
69 ## [2.4.9] - 2023-04-15
73 - Add tasks queue enablement runtime setter to pool.
74 - Add tasks queue options runtime setter to pool.
75 - Add worker choice strategy options runtime setter to pool.
79 - Remove the tasks queuing experimental status.
83 - Fix worker function type definition and validation.
84 - Fix worker choice strategy options handling.
86 ## [2.4.8] - 2023-04-12
90 - Fix message between main worker and worker type definition for tasks.
91 - Fix code documentation.
93 ## [2.4.7] - 2023-04-11
97 - Add worker tasks queue options to pool options.
101 - Fix missing documentation.
103 ## [2.4.6] - 2023-04-10
107 - Ensure one task at a time is executed per worker with tasks queueing enabled.
108 - Properly count worker running tasks with tasks queueing enabled.
110 ## [2.4.5] - 2023-04-09
114 - Use monotonic high resolution timer for worker tasks runtime.
115 - Add worker tasks median runtime to statistics.
116 - Add worker tasks queue (experimental).
118 ## [2.4.4] - 2023-04-07
122 - Add `PoolEvents` enumeration and `PoolEvent` type.
126 - Destroy worker only on alive check.
128 ## [2.4.3] - 2023-04-07
132 - Fix typedoc generation with inheritance.
134 ## [2.4.2] - 2023-04-06
138 - Add `full` event to dynamic pool.
139 - Keep worker choice strategy in memory for conditional reuse.
143 - Fix possible negative worker key at worker removal in worker choice strategies.
145 ## [2.4.1] - 2023-04-05
149 - Optimize worker choice strategy for dynamic pool.
153 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
155 ## [2.4.0] - 2023-04-04
159 - Add `LESS_BUSY` worker choice strategy.
163 - Optimize worker storage in pool.
164 - Optimize worker alive status check.
165 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
166 - Optimize `LESS_USED` worker choice strategy.
167 - Update benchmarks versus external threads pools.
168 - Optimize tasks usage statistics requirements for worker choice strategy.
172 - Ensure trimmable characters are checked at pool initialization.
173 - Fix message id integer overflow.
174 - Fix pool worker removal in worker choice strategy internals.
175 - Fix package publication with pnpm.
177 ## [2.4.0-3] - 2023-04-04
181 - Add `LESS_BUSY` worker choice strategy.
185 - Optimize worker storage in pool.
186 - Optimize worker alive status check.
187 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
188 - Optimize `LESS_USED` worker choice strategy.
189 - Update benchmarks versus external threads pools.
193 - Ensure trimmable characters are checked at pool initialization.
194 - Fix message id integer overflow.
195 - Fix pool worker removal in worker choice strategy internals.
196 - Fix package publication with pnpm.
198 ## [2.4.0-2] - 2023-04-03
202 - Add `LESS_BUSY` worker choice strategy.
206 - Optimize worker storage in pool.
207 - Optimize worker alive status check.
208 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
209 - Optimize `LESS_USED` worker choice strategy.
213 - Ensure trimmable characters are checked at pool initialization.
214 - Fix message id integer overflow.
215 - Fix pool worker removal in worker choice strategy internals.
216 - Fix package publication with pnpm.
218 ## [2.4.0-1] - 2023-04-03
222 - Add `LESS_BUSY` worker choice strategy.
226 - Optimize worker storage in pool.
227 - Optimize worker alive status check.
228 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
229 - Optimize `LESS_USED` worker choice strategy.
233 - Ensure trimmable characters are checked at pool initialization.
234 - Fix message id integer overflow.
235 - Fix pool worker removal in worker choice strategy internals.
237 ## [2.4.0-0] - 2023-04-03
241 - Add `LESS_BUSY` worker choice strategy.
245 - Optimize worker storage in pool.
246 - Optimize worker alive status check.
247 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
248 - Optimize `LESS_USED` worker choice strategy.
252 - Ensure trimmable characters are checked at pool initialization.
253 - Fix message id integer overflow.
254 - Fix pool worker removal in worker choice strategy internals.
256 ## [2.3.10] - 2023-03-18
260 - Fix `exports` syntax for ESM and CommonJS.
264 - Permit SemVer pre-release publication.
266 ## [2.3.10-2] - 2023-03-18
270 - Fix `exports` syntax for ESM and CommonJS.
272 ## [2.3.10-1] - 2023-03-18
276 - Permit SemVer pre-release publication.
278 ## [2.3.10-0] - 2023-03-18
282 - Fix `exports` syntax for ESM and CommonJS.
284 ## [2.3.9] - 2023-03-18
288 - Introduce ESM module support along with CommonJS one.
292 - Fix brown paper bag bug referencing the same object literal.
294 ## [2.3.8] - 2023-03-18
298 - Switch internal benchmarking code to benny.
299 - Switch to TypeScript 5.x.x.
300 - Switch rollup bundler plugins to core ones.
301 - Switch to TSDoc syntax.
302 - Enforce conventional commits.
306 - Fix random integer generator.
307 - Fix worker choice strategy pool type identification at initialization.
309 ## [2.3.7] - 2022-10-23
313 - Switch to open collective FOSS project funding platform.
314 - Switch to ts-standard linter configuration on TypeScript code.
318 - Fixed missing async on pool execute method.
319 - Fixed typing in TypeScript example.
320 - Fixed types in unit tests.
322 ## [2.3.6] - 2022-10-22
326 - Cleanup pool attributes and methods.
327 - Refine error types thrown.
331 - Fix continuous integration build on windows.
332 - Fix code coverage reporting by using c8 instead of nyc.
334 ## [2.3.5] - 2022-10-21
338 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
339 - Optimize tasks usage lookup implementation.
343 - Fix missed pool event emitter type export.
344 - Fix typedoc documentation generation.
346 ## [2.3.4] - 2022-10-17
350 - Fully automate release process with release-it.
354 - Optimize fair share task scheduling algorithm implementation.
355 - Update benchmarks versus external pools results with latest version.
357 ## [2.3.3] - 2022-10-15
361 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
363 ## [2.3.2] - 2022-10-14
367 - Optimize fair share worker selection strategy implementation.
371 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
373 ## [2.3.1] - 2022-10-13
377 - Pool worker choice strategies:
378 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
379 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
381 ## [2.2.2] - 2022-10-09
385 - Fixed `README.md` file.
387 ## [2.2.1] - 2022-10-08
391 - Dynamic worker choice strategy change at runtime.
393 ## [2.2.0] - 2022-01-05
397 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
399 ## [2.1.0] - 2021-08-29
403 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
407 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
408 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
409 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
410 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
412 ## [2.0.2] - 2021-05-12
416 - Fix `busy` event emission on fixed pool type
418 ## [2.0.1] - 2021-03-16
422 - Check if pool options are properly set.
423 - `busy` event is emitted on all pool types.
425 ## [2.0.0] - 2021-03-01
429 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
433 - `FullPool` event is now renamed to `busy`.
434 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
435 _Find more details on our JSDoc._
437 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
439 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
441 ### Pool options types declaration merge
443 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
445 #### New `export` strategy
449 const DynamicThreadPool = require('poolifier/lib/dynamic')
451 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
454 But you should always prefer just using
457 const { DynamicThreadPool } = require('poolifier')
460 #### New type definitions for input data and response
462 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
463 _This is not a limitation by poolifier but NodeJS._
465 #### Public property replacements
467 `numWorkers` property is now `numberOfWorkers`
469 #### Internal (protected) properties and methods renaming
471 These properties are not intended for end users
473 - `id` => `nextMessageId`
475 These methods are not intended for end users
477 - `_chooseWorker` => `chooseWorker`
478 - `_newWorker` => `createWorker`
479 - `_execute` => `internalExecute`
480 - `_chooseWorker` => `chooseWorker`
481 - `_checkAlive` => `checkAlive`
483 - `_runAsync` => `runAsync`
485 ## [1.1.0] - 2020-05-21
489 - ThreadWorker support async functions as option
490 - Various external library patches
492 ## [1.0.0] - 2020-01-24
496 - FixedThreadPool implementation
497 - DynamicThreadPool implementation
498 - WorkerThread implementation to improve developer experience