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 - Switch pool event emitter to `EventEmitterAsyncResource`.
13 - Add tasks wait time accounting in per worker tasks usage.
14 - Add interleaved weighted round robin worker choice strategy (experimental).
18 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
20 ## [2.4.14] - 2023-05-09
24 - Ensure no undefined task runtime can land in the tasks history.
25 - Fix median computation implementation once again.
29 - Unit tests for median and queue implementations.
31 ## [2.4.13] - 2023-05-08
35 - Fix worker choice strategy options validation.
36 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
38 ## [2.4.12] - 2023-05-06
42 - Support multiple task functions per worker.
43 - Add custom worker weights support to worker choice strategies options.
47 - Use O(1) queue implementation for tasks queueing.
51 - Fix median computation implementation.
52 - Fix fair share worker choice strategy internals update.
54 ## [2.4.11] - 2023-04-23
58 - Optimize free worker finding in worker choice strategies.
60 ## [2.4.10] - 2023-04-15
64 - Fix typescript type definition for worker function: ensure the input data is optional.
65 - Fix typescript type definition for pool execute(): ensure the input data is optional.
67 ## [2.4.9] - 2023-04-15
71 - Add tasks queue enablement runtime setter to pool.
72 - Add tasks queue options runtime setter to pool.
73 - Add worker choice strategy options runtime setter to pool.
77 - Remove the tasks queuing experimental status.
81 - Fix worker function type definition and validation.
82 - Fix worker choice strategy options handling.
84 ## [2.4.8] - 2023-04-12
88 - Fix message between main worker and worker type definition for tasks.
89 - Fix code documentation.
91 ## [2.4.7] - 2023-04-11
95 - Add worker tasks queue options to pool options.
99 - Fix missing documentation.
101 ## [2.4.6] - 2023-04-10
105 - Ensure one task at a time is executed per worker with tasks queueing enabled.
106 - Properly count worker running tasks with tasks queueing enabled.
108 ## [2.4.5] - 2023-04-09
112 - Use monotonic high resolution timer for worker tasks runtime.
113 - Add worker tasks median runtime to statistics.
114 - Add worker tasks queue (experimental).
116 ## [2.4.4] - 2023-04-07
120 - Add `PoolEvents` enumeration and `PoolEvent` type.
124 - Destroy worker only on alive check.
126 ## [2.4.3] - 2023-04-07
130 - Fix typedoc generation with inheritance.
132 ## [2.4.2] - 2023-04-06
136 - Add `full` event to dynamic pool.
137 - Keep worker choice strategy in memory for conditional reuse.
141 - Fix possible negative worker key at worker removal in worker choice strategies.
143 ## [2.4.1] - 2023-04-05
147 - Optimize worker choice strategy for dynamic pool.
151 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
153 ## [2.4.0] - 2023-04-04
157 - Add `LESS_BUSY` worker choice strategy.
161 - Optimize worker storage in pool.
162 - Optimize worker alive status check.
163 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
164 - Optimize `LESS_USED` worker choice strategy.
165 - Update benchmarks versus external threads pools.
166 - Optimize tasks usage statistics requirements for worker choice strategy.
170 - Ensure trimmable characters are checked at pool initialization.
171 - Fix message id integer overflow.
172 - Fix pool worker removal in worker choice strategy internals.
173 - Fix package publication with pnpm.
175 ## [2.4.0-3] - 2023-04-04
179 - Add `LESS_BUSY` worker choice strategy.
183 - Optimize worker storage in pool.
184 - Optimize worker alive status check.
185 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
186 - Optimize `LESS_USED` worker choice strategy.
187 - Update benchmarks versus external threads pools.
191 - Ensure trimmable characters are checked at pool initialization.
192 - Fix message id integer overflow.
193 - Fix pool worker removal in worker choice strategy internals.
194 - Fix package publication with pnpm.
196 ## [2.4.0-2] - 2023-04-03
200 - Add `LESS_BUSY` worker choice strategy.
204 - Optimize worker storage in pool.
205 - Optimize worker alive status check.
206 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
207 - Optimize `LESS_USED` worker choice strategy.
211 - Ensure trimmable characters are checked at pool initialization.
212 - Fix message id integer overflow.
213 - Fix pool worker removal in worker choice strategy internals.
214 - Fix package publication with pnpm.
216 ## [2.4.0-1] - 2023-04-03
220 - Add `LESS_BUSY` worker choice strategy.
224 - Optimize worker storage in pool.
225 - Optimize worker alive status check.
226 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
227 - Optimize `LESS_USED` worker choice strategy.
231 - Ensure trimmable characters are checked at pool initialization.
232 - Fix message id integer overflow.
233 - Fix pool worker removal in worker choice strategy internals.
235 ## [2.4.0-0] - 2023-04-03
239 - Add `LESS_BUSY` worker choice strategy.
243 - Optimize worker storage in pool.
244 - Optimize worker alive status check.
245 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
246 - Optimize `LESS_USED` worker choice strategy.
250 - Ensure trimmable characters are checked at pool initialization.
251 - Fix message id integer overflow.
252 - Fix pool worker removal in worker choice strategy internals.
254 ## [2.3.10] - 2023-03-18
258 - Fix `exports` syntax for ESM and CommonJS.
262 - Permit SemVer pre-release publication.
264 ## [2.3.10-2] - 2023-03-18
268 - Fix `exports` syntax for ESM and CommonJS.
270 ## [2.3.10-1] - 2023-03-18
274 - Permit SemVer pre-release publication.
276 ## [2.3.10-0] - 2023-03-18
280 - Fix `exports` syntax for ESM and CommonJS.
282 ## [2.3.9] - 2023-03-18
286 - Introduce ESM module support along with CommonJS one.
290 - Fix brown paper bag bug referencing the same object literal.
292 ## [2.3.8] - 2023-03-18
296 - Switch internal benchmarking code to benny.
297 - Switch to TypeScript 5.x.x.
298 - Switch rollup bundler plugins to core ones.
299 - Switch to TSDoc syntax.
300 - Enforce conventional commits.
304 - Fix random integer generator.
305 - Fix worker choice strategy pool type identification at initialization.
307 ## [2.3.7] - 2022-10-23
311 - Switch to open collective FOSS project funding platform.
312 - Switch to ts-standard linter configuration on TypeScript code.
316 - Fixed missing async on pool execute method.
317 - Fixed typing in TypeScript example.
318 - Fixed types in unit tests.
320 ## [2.3.6] - 2022-10-22
324 - Cleanup pool attributes and methods.
325 - Refine error types thrown.
329 - Fix continuous integration build on windows.
330 - Fix code coverage reporting by using c8 instead of nyc.
332 ## [2.3.5] - 2022-10-21
336 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
337 - Optimize tasks usage lookup implementation.
341 - Fix missed pool event emitter type export.
342 - Fix typedoc documentation generation.
344 ## [2.3.4] - 2022-10-17
348 - Fully automate release process with release-it.
352 - Optimize fair share task scheduling algorithm implementation.
353 - Update benchmarks versus external pools results with latest version.
355 ## [2.3.3] - 2022-10-15
359 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
361 ## [2.3.2] - 2022-10-14
365 - Optimize fair share worker selection strategy implementation.
369 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
371 ## [2.3.1] - 2022-10-13
375 - Pool worker choice strategies:
376 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
377 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
379 ## [2.2.2] - 2022-10-09
383 - Fixed `README.md` file.
385 ## [2.2.1] - 2022-10-08
389 - Dynamic worker choice strategy change at runtime.
391 ## [2.2.0] - 2022-01-05
395 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
397 ## [2.1.0] - 2021-08-29
401 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
405 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
406 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
407 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
408 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
410 ## [2.0.2] - 2021-05-12
414 - Fix `busy` event emission on fixed pool type
416 ## [2.0.1] - 2021-03-16
420 - Check if pool options are properly set.
421 - `busy` event is emitted on all pool types.
423 ## [2.0.0] - 2021-03-01
427 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
431 - `FullPool` event is now renamed to `busy`.
432 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
433 _Find more details on our JSDoc._
435 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
437 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
439 ### Pool options types declaration merge
441 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
443 #### New `export` strategy
447 const DynamicThreadPool = require('poolifier/lib/dynamic')
449 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
452 But you should always prefer just using
455 const { DynamicThreadPool } = require('poolifier')
458 #### New type definitions for input data and response
460 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
461 _This is not a limitation by poolifier but NodeJS._
463 #### Public property replacements
465 `numWorkers` property is now `numberOfWorkers`
467 #### Internal (protected) properties and methods renaming
469 These properties are not intended for end users
471 - `id` => `nextMessageId`
473 These methods are not intended for end users
475 - `_chooseWorker` => `chooseWorker`
476 - `_newWorker` => `createWorker`
477 - `_execute` => `internalExecute`
478 - `_chooseWorker` => `chooseWorker`
479 - `_checkAlive` => `checkAlive`
481 - `_runAsync` => `runAsync`
483 ## [1.1.0] - 2020-05-21
487 - ThreadWorker support async functions as option
488 - Various external library patches
490 ## [1.0.0] - 2020-01-24
494 - FixedThreadPool implementation
495 - DynamicThreadPool implementation
496 - WorkerThread implementation to improve developer experience