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 - Add Event Loop Utilization (ELU) statistics to worker tasks usage.
16 - Compute statistics at the worker level only if needed.
18 ## [2.5.3] - 2023-06-04
22 - Refine pool information content.
23 - Limit pool internals public exposure.
25 ## [2.5.2] - 2023-06-02
29 - Add `taskError` pool event for task execution error.
30 - Add pool information `info` property to pool.
31 - Emit pool information on `busy` and `full` pool events.
33 ## [2.5.1] - 2023-06-01
37 - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
38 - Add `error` pool event for uncaught worker error.
40 ## [2.5.0] - 2023-05-31
44 - Switch pool event emitter to `EventEmitterAsyncResource`.
45 - Add tasks wait time accounting in per worker tasks usage.
46 - Add interleaved weighted round robin worker choice strategy (experimental).
50 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
52 ## [2.4.14] - 2023-05-09
56 - Ensure no undefined task runtime can land in the tasks history.
57 - Fix median computation implementation once again.
61 - Unit tests for median and queue implementations.
63 ## [2.4.13] - 2023-05-08
67 - Fix worker choice strategy options validation.
68 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
70 ## [2.4.12] - 2023-05-06
74 - Support multiple task functions per worker.
75 - Add custom worker weights support to worker choice strategies options.
79 - Use O(1) queue implementation for tasks queueing.
83 - Fix median computation implementation.
84 - Fix fair share worker choice strategy internals update.
86 ## [2.4.11] - 2023-04-23
90 - Optimize free worker finding in worker choice strategies.
92 ## [2.4.10] - 2023-04-15
96 - Fix typescript type definition for worker function: ensure the input data is optional.
97 - Fix typescript type definition for pool execute(): ensure the input data is optional.
99 ## [2.4.9] - 2023-04-15
103 - Add tasks queue enablement runtime setter to pool.
104 - Add tasks queue options runtime setter to pool.
105 - Add worker choice strategy options runtime setter to pool.
109 - Remove the tasks queuing experimental status.
113 - Fix worker function type definition and validation.
114 - Fix worker choice strategy options handling.
116 ## [2.4.8] - 2023-04-12
120 - Fix message between main worker and worker type definition for tasks.
121 - Fix code documentation.
123 ## [2.4.7] - 2023-04-11
127 - Add worker tasks queue options to pool options.
131 - Fix missing documentation.
133 ## [2.4.6] - 2023-04-10
137 - Ensure one task at a time is executed per worker with tasks queueing enabled.
138 - Properly count worker running tasks with tasks queueing enabled.
140 ## [2.4.5] - 2023-04-09
144 - Use monotonic high resolution timer for worker tasks runtime.
145 - Add worker tasks median runtime to statistics.
146 - Add worker tasks queue (experimental).
148 ## [2.4.4] - 2023-04-07
152 - Add `PoolEvents` enumeration and `PoolEvent` type.
156 - Destroy worker only on alive check.
158 ## [2.4.3] - 2023-04-07
162 - Fix typedoc generation with inheritance.
164 ## [2.4.2] - 2023-04-06
168 - Add `full` event to dynamic pool.
169 - Keep worker choice strategy in memory for conditional reuse.
173 - Fix possible negative worker key at worker removal in worker choice strategies.
175 ## [2.4.1] - 2023-04-05
179 - Optimize worker choice strategy for dynamic pool.
183 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
185 ## [2.4.0] - 2023-04-04
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.
197 - Update benchmarks versus external threads pools.
198 - Optimize tasks usage statistics requirements for worker choice strategy.
202 - Ensure trimmable characters are checked at pool initialization.
203 - Fix message id integer overflow.
204 - Fix pool worker removal in worker choice strategy internals.
205 - Fix package publication with pnpm.
207 ## [2.4.0-3] - 2023-04-04
211 - Add `LESS_BUSY` worker choice strategy.
215 - Optimize worker storage in pool.
216 - Optimize worker alive status check.
217 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
218 - Optimize `LESS_USED` worker choice strategy.
219 - Update benchmarks versus external threads pools.
223 - Ensure trimmable characters are checked at pool initialization.
224 - Fix message id integer overflow.
225 - Fix pool worker removal in worker choice strategy internals.
226 - Fix package publication with pnpm.
228 ## [2.4.0-2] - 2023-04-03
232 - Add `LESS_BUSY` worker choice strategy.
236 - Optimize worker storage in pool.
237 - Optimize worker alive status check.
238 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
239 - Optimize `LESS_USED` worker choice strategy.
243 - Ensure trimmable characters are checked at pool initialization.
244 - Fix message id integer overflow.
245 - Fix pool worker removal in worker choice strategy internals.
246 - Fix package publication with pnpm.
248 ## [2.4.0-1] - 2023-04-03
252 - Add `LESS_BUSY` worker choice strategy.
256 - Optimize worker storage in pool.
257 - Optimize worker alive status check.
258 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
259 - Optimize `LESS_USED` worker choice strategy.
263 - Ensure trimmable characters are checked at pool initialization.
264 - Fix message id integer overflow.
265 - Fix pool worker removal in worker choice strategy internals.
267 ## [2.4.0-0] - 2023-04-03
271 - Add `LESS_BUSY` worker choice strategy.
275 - Optimize worker storage in pool.
276 - Optimize worker alive status check.
277 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
278 - Optimize `LESS_USED` worker choice strategy.
282 - Ensure trimmable characters are checked at pool initialization.
283 - Fix message id integer overflow.
284 - Fix pool worker removal in worker choice strategy internals.
286 ## [2.3.10] - 2023-03-18
290 - Fix `exports` syntax for ESM and CommonJS.
294 - Permit SemVer pre-release publication.
296 ## [2.3.10-2] - 2023-03-18
300 - Fix `exports` syntax for ESM and CommonJS.
302 ## [2.3.10-1] - 2023-03-18
306 - Permit SemVer pre-release publication.
308 ## [2.3.10-0] - 2023-03-18
312 - Fix `exports` syntax for ESM and CommonJS.
314 ## [2.3.9] - 2023-03-18
318 - Introduce ESM module support along with CommonJS one.
322 - Fix brown paper bag bug referencing the same object literal.
324 ## [2.3.8] - 2023-03-18
328 - Switch internal benchmarking code to benny.
329 - Switch to TypeScript 5.x.x.
330 - Switch rollup bundler plugins to core ones.
331 - Switch to TSDoc syntax.
332 - Enforce conventional commits.
336 - Fix random integer generator.
337 - Fix worker choice strategy pool type identification at initialization.
339 ## [2.3.7] - 2022-10-23
343 - Switch to open collective FOSS project funding platform.
344 - Switch to ts-standard linter configuration on TypeScript code.
348 - Fixed missing async on pool execute method.
349 - Fixed typing in TypeScript example.
350 - Fixed types in unit tests.
352 ## [2.3.6] - 2022-10-22
356 - Cleanup pool attributes and methods.
357 - Refine error types thrown.
361 - Fix continuous integration build on windows.
362 - Fix code coverage reporting by using c8 instead of nyc.
364 ## [2.3.5] - 2022-10-21
368 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
369 - Optimize tasks usage lookup implementation.
373 - Fix missed pool event emitter type export.
374 - Fix typedoc documentation generation.
376 ## [2.3.4] - 2022-10-17
380 - Fully automate release process with release-it.
384 - Optimize fair share task scheduling algorithm implementation.
385 - Update benchmarks versus external pools results with latest version.
387 ## [2.3.3] - 2022-10-15
391 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
393 ## [2.3.2] - 2022-10-14
397 - Optimize fair share worker selection strategy implementation.
401 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
403 ## [2.3.1] - 2022-10-13
407 - Pool worker choice strategies:
408 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
409 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
411 ## [2.2.2] - 2022-10-09
415 - Fixed `README.md` file.
417 ## [2.2.1] - 2022-10-08
421 - Dynamic worker choice strategy change at runtime.
423 ## [2.2.0] - 2022-01-05
427 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
429 ## [2.1.0] - 2021-08-29
433 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
437 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
438 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
439 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
440 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
442 ## [2.0.2] - 2021-05-12
446 - Fix `busy` event emission on fixed pool type
448 ## [2.0.1] - 2021-03-16
452 - Check if pool options are properly set.
453 - `busy` event is emitted on all pool types.
455 ## [2.0.0] - 2021-03-01
459 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
463 - `FullPool` event is now renamed to `busy`.
464 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
465 _Find more details on our JSDoc._
467 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
469 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
471 ### Pool options types declaration merge
473 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
475 #### New `export` strategy
479 const DynamicThreadPool = require('poolifier/lib/dynamic')
481 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
484 But you should always prefer just using
487 const { DynamicThreadPool } = require('poolifier')
490 #### New type definitions for input data and response
492 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
493 _This is not a limitation by poolifier but NodeJS._
495 #### Public property replacements
497 `numWorkers` property is now `numberOfWorkers`
499 #### Internal (protected) properties and methods renaming
501 These properties are not intended for end users
503 - `id` => `nextMessageId`
505 These methods are not intended for end users
507 - `_chooseWorker` => `chooseWorker`
508 - `_newWorker` => `createWorker`
509 - `_execute` => `internalExecute`
510 - `_chooseWorker` => `chooseWorker`
511 - `_checkAlive` => `checkAlive`
513 - `_runAsync` => `runAsync`
515 ## [1.1.0] - 2020-05-21
519 - ThreadWorker support async functions as option
520 - Various external library patches
522 ## [1.0.0] - 2020-01-24
526 - FixedThreadPool implementation
527 - DynamicThreadPool implementation
528 - WorkerThread implementation to improve developer experience