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 - Refine pool information content.
13 - Limit pool internals public exposure.
15 ## [2.5.2] - 2023-06-02
19 - Add `taskError` pool event for task execution error.
20 - Add pool information `info` property to pool.
21 - Emit pool information on `busy` and `full` pool events.
23 ## [2.5.1] - 2023-06-01
27 - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
28 - Add `error` pool event for uncaught worker error.
30 ## [2.5.0] - 2023-05-31
34 - Switch pool event emitter to `EventEmitterAsyncResource`.
35 - Add tasks wait time accounting in per worker tasks usage.
36 - Add interleaved weighted round robin worker choice strategy (experimental).
40 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
42 ## [2.4.14] - 2023-05-09
46 - Ensure no undefined task runtime can land in the tasks history.
47 - Fix median computation implementation once again.
51 - Unit tests for median and queue implementations.
53 ## [2.4.13] - 2023-05-08
57 - Fix worker choice strategy options validation.
58 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
60 ## [2.4.12] - 2023-05-06
64 - Support multiple task functions per worker.
65 - Add custom worker weights support to worker choice strategies options.
69 - Use O(1) queue implementation for tasks queueing.
73 - Fix median computation implementation.
74 - Fix fair share worker choice strategy internals update.
76 ## [2.4.11] - 2023-04-23
80 - Optimize free worker finding in worker choice strategies.
82 ## [2.4.10] - 2023-04-15
86 - Fix typescript type definition for worker function: ensure the input data is optional.
87 - Fix typescript type definition for pool execute(): ensure the input data is optional.
89 ## [2.4.9] - 2023-04-15
93 - Add tasks queue enablement runtime setter to pool.
94 - Add tasks queue options runtime setter to pool.
95 - Add worker choice strategy options runtime setter to pool.
99 - Remove the tasks queuing experimental status.
103 - Fix worker function type definition and validation.
104 - Fix worker choice strategy options handling.
106 ## [2.4.8] - 2023-04-12
110 - Fix message between main worker and worker type definition for tasks.
111 - Fix code documentation.
113 ## [2.4.7] - 2023-04-11
117 - Add worker tasks queue options to pool options.
121 - Fix missing documentation.
123 ## [2.4.6] - 2023-04-10
127 - Ensure one task at a time is executed per worker with tasks queueing enabled.
128 - Properly count worker running tasks with tasks queueing enabled.
130 ## [2.4.5] - 2023-04-09
134 - Use monotonic high resolution timer for worker tasks runtime.
135 - Add worker tasks median runtime to statistics.
136 - Add worker tasks queue (experimental).
138 ## [2.4.4] - 2023-04-07
142 - Add `PoolEvents` enumeration and `PoolEvent` type.
146 - Destroy worker only on alive check.
148 ## [2.4.3] - 2023-04-07
152 - Fix typedoc generation with inheritance.
154 ## [2.4.2] - 2023-04-06
158 - Add `full` event to dynamic pool.
159 - Keep worker choice strategy in memory for conditional reuse.
163 - Fix possible negative worker key at worker removal in worker choice strategies.
165 ## [2.4.1] - 2023-04-05
169 - Optimize worker choice strategy for dynamic pool.
173 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
175 ## [2.4.0] - 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.
188 - Optimize tasks usage statistics requirements for worker choice strategy.
192 - Ensure trimmable characters are checked at pool initialization.
193 - Fix message id integer overflow.
194 - Fix pool worker removal in worker choice strategy internals.
195 - Fix package publication with pnpm.
197 ## [2.4.0-3] - 2023-04-04
201 - Add `LESS_BUSY` worker choice strategy.
205 - Optimize worker storage in pool.
206 - Optimize worker alive status check.
207 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
208 - Optimize `LESS_USED` worker choice strategy.
209 - Update benchmarks versus external threads pools.
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-2] - 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.
236 - Fix package publication with pnpm.
238 ## [2.4.0-1] - 2023-04-03
242 - Add `LESS_BUSY` worker choice strategy.
246 - Optimize worker storage in pool.
247 - Optimize worker alive status check.
248 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
249 - Optimize `LESS_USED` worker choice strategy.
253 - Ensure trimmable characters are checked at pool initialization.
254 - Fix message id integer overflow.
255 - Fix pool worker removal in worker choice strategy internals.
257 ## [2.4.0-0] - 2023-04-03
261 - Add `LESS_BUSY` worker choice strategy.
265 - Optimize worker storage in pool.
266 - Optimize worker alive status check.
267 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
268 - Optimize `LESS_USED` worker choice strategy.
272 - Ensure trimmable characters are checked at pool initialization.
273 - Fix message id integer overflow.
274 - Fix pool worker removal in worker choice strategy internals.
276 ## [2.3.10] - 2023-03-18
280 - Fix `exports` syntax for ESM and CommonJS.
284 - Permit SemVer pre-release publication.
286 ## [2.3.10-2] - 2023-03-18
290 - Fix `exports` syntax for ESM and CommonJS.
292 ## [2.3.10-1] - 2023-03-18
296 - Permit SemVer pre-release publication.
298 ## [2.3.10-0] - 2023-03-18
302 - Fix `exports` syntax for ESM and CommonJS.
304 ## [2.3.9] - 2023-03-18
308 - Introduce ESM module support along with CommonJS one.
312 - Fix brown paper bag bug referencing the same object literal.
314 ## [2.3.8] - 2023-03-18
318 - Switch internal benchmarking code to benny.
319 - Switch to TypeScript 5.x.x.
320 - Switch rollup bundler plugins to core ones.
321 - Switch to TSDoc syntax.
322 - Enforce conventional commits.
326 - Fix random integer generator.
327 - Fix worker choice strategy pool type identification at initialization.
329 ## [2.3.7] - 2022-10-23
333 - Switch to open collective FOSS project funding platform.
334 - Switch to ts-standard linter configuration on TypeScript code.
338 - Fixed missing async on pool execute method.
339 - Fixed typing in TypeScript example.
340 - Fixed types in unit tests.
342 ## [2.3.6] - 2022-10-22
346 - Cleanup pool attributes and methods.
347 - Refine error types thrown.
351 - Fix continuous integration build on windows.
352 - Fix code coverage reporting by using c8 instead of nyc.
354 ## [2.3.5] - 2022-10-21
358 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
359 - Optimize tasks usage lookup implementation.
363 - Fix missed pool event emitter type export.
364 - Fix typedoc documentation generation.
366 ## [2.3.4] - 2022-10-17
370 - Fully automate release process with release-it.
374 - Optimize fair share task scheduling algorithm implementation.
375 - Update benchmarks versus external pools results with latest version.
377 ## [2.3.3] - 2022-10-15
381 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
383 ## [2.3.2] - 2022-10-14
387 - Optimize fair share worker selection strategy implementation.
391 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
393 ## [2.3.1] - 2022-10-13
397 - Pool worker choice strategies:
398 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
399 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
401 ## [2.2.2] - 2022-10-09
405 - Fixed `README.md` file.
407 ## [2.2.1] - 2022-10-08
411 - Dynamic worker choice strategy change at runtime.
413 ## [2.2.0] - 2022-01-05
417 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
419 ## [2.1.0] - 2021-08-29
423 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
427 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
428 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
429 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
430 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
432 ## [2.0.2] - 2021-05-12
436 - Fix `busy` event emission on fixed pool type
438 ## [2.0.1] - 2021-03-16
442 - Check if pool options are properly set.
443 - `busy` event is emitted on all pool types.
445 ## [2.0.0] - 2021-03-01
449 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
453 - `FullPool` event is now renamed to `busy`.
454 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
455 _Find more details on our JSDoc._
457 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
459 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
461 ### Pool options types declaration merge
463 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
465 #### New `export` strategy
469 const DynamicThreadPool = require('poolifier/lib/dynamic')
471 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
474 But you should always prefer just using
477 const { DynamicThreadPool } = require('poolifier')
480 #### New type definitions for input data and response
482 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
483 _This is not a limitation by poolifier but NodeJS._
485 #### Public property replacements
487 `numWorkers` property is now `numberOfWorkers`
489 #### Internal (protected) properties and methods renaming
491 These properties are not intended for end users
493 - `id` => `nextMessageId`
495 These methods are not intended for end users
497 - `_chooseWorker` => `chooseWorker`
498 - `_newWorker` => `createWorker`
499 - `_execute` => `internalExecute`
500 - `_chooseWorker` => `chooseWorker`
501 - `_checkAlive` => `checkAlive`
503 - `_runAsync` => `runAsync`
505 ## [1.1.0] - 2020-05-21
509 - ThreadWorker support async functions as option
510 - Various external library patches
512 ## [1.0.0] - 2020-01-24
516 - FixedThreadPool implementation
517 - DynamicThreadPool implementation
518 - WorkerThread implementation to improve developer experience