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 - Ensure no undefined task runtime can land in the tasks history.
13 - Fix median computation implementation once again.
17 - Unit tests for median and queue implementations.
19 ## [2.4.13] - 2023-05-08
23 - Fix worker choice strategy options validation.
24 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
26 ## [2.4.12] - 2023-05-06
30 - Support multiple task functions per worker.
31 - Add custom worker weights support to worker choice strategies options.
35 - Use O(1) queue implementation for tasks queueing.
39 - Fix median computation implementation.
40 - Fix fair share worker choice strategy internals update.
42 ## [2.4.11] - 2023-04-23
46 - Optimize free worker finding in worker choice strategies.
48 ## [2.4.10] - 2023-04-15
52 - Fix typescript type definition for worker function: ensure the input data is optional.
53 - Fix typescript type definition for pool execute(): ensure the input data is optional.
55 ## [2.4.9] - 2023-04-15
59 - Add tasks queue enablement runtime setter to pool.
60 - Add tasks queue options runtime setter to pool.
61 - Add worker choice strategy options runtime setter to pool.
65 - Remove the tasks queuing experimental status.
69 - Fix worker function type definition and validation.
70 - Fix worker choice strategy options handling.
72 ## [2.4.8] - 2023-04-12
76 - Fix message between main worker and worker type definition for tasks.
77 - Fix code documentation.
79 ## [2.4.7] - 2023-04-11
83 - Add worker tasks queue options to pool options.
87 - Fix missing documentation.
89 ## [2.4.6] - 2023-04-10
93 - Ensure one task at a time is executed per worker with tasks queueing enabled.
94 - Properly count worker running tasks with tasks queueing enabled.
96 ## [2.4.5] - 2023-04-09
100 - Use monotonic high resolution timer for worker tasks run time.
101 - Add worker tasks median run time to statistics.
102 - Add worker tasks queue (experimental).
104 ## [2.4.4] - 2023-04-07
108 - Add `PoolEvents` enumeration and `PoolEvent` type.
112 - Destroy worker only on alive check.
114 ## [2.4.3] - 2023-04-07
118 - Fix typedoc generation with inheritance.
120 ## [2.4.2] - 2023-04-06
124 - Add `full` event to dynamic pool.
125 - Keep worker choice strategy in memory for conditional reuse.
129 - Fix possible negative worker key at worker removal in worker choice strategies.
131 ## [2.4.1] - 2023-04-05
135 - Optimize worker choice strategy for dynamic pool.
139 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
141 ## [2.4.0] - 2023-04-04
145 - Add `LESS_BUSY` worker choice strategy.
149 - Optimize worker storage in pool.
150 - Optimize worker alive status check.
151 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
152 - Optimize `LESS_USED` worker choice strategy.
153 - Update benchmarks versus external threads pools.
154 - Optimize tasks usage statistics requirements for worker choice strategy.
158 - Ensure trimmable characters are checked at pool initialization.
159 - Fix message id integer overflow.
160 - Fix pool worker removal in worker choice strategy internals.
161 - Fix package publication with pnpm.
163 ## [2.4.0-3] - 2023-04-04
167 - Add `LESS_BUSY` worker choice strategy.
171 - Optimize worker storage in pool.
172 - Optimize worker alive status check.
173 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
174 - Optimize `LESS_USED` worker choice strategy.
175 - Update benchmarks versus external threads pools.
179 - Ensure trimmable characters are checked at pool initialization.
180 - Fix message id integer overflow.
181 - Fix pool worker removal in worker choice strategy internals.
182 - Fix package publication with pnpm.
184 ## [2.4.0-2] - 2023-04-03
188 - Add `LESS_BUSY` worker choice strategy.
192 - Optimize worker storage in pool.
193 - Optimize worker alive status check.
194 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
195 - Optimize `LESS_USED` worker choice strategy.
199 - Ensure trimmable characters are checked at pool initialization.
200 - Fix message id integer overflow.
201 - Fix pool worker removal in worker choice strategy internals.
202 - Fix package publication with pnpm.
204 ## [2.4.0-1] - 2023-04-03
208 - Add `LESS_BUSY` worker choice strategy.
212 - Optimize worker storage in pool.
213 - Optimize worker alive status check.
214 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
215 - Optimize `LESS_USED` worker choice strategy.
219 - Ensure trimmable characters are checked at pool initialization.
220 - Fix message id integer overflow.
221 - Fix pool worker removal in worker choice strategy internals.
223 ## [2.4.0-0] - 2023-04-03
227 - Add `LESS_BUSY` worker choice strategy.
231 - Optimize worker storage in pool.
232 - Optimize worker alive status check.
233 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
234 - Optimize `LESS_USED` worker choice strategy.
238 - Ensure trimmable characters are checked at pool initialization.
239 - Fix message id integer overflow.
240 - Fix pool worker removal in worker choice strategy internals.
242 ## [2.3.10] - 2023-03-18
246 - Fix `exports` syntax for ESM and CommonJS.
250 - Permit SemVer pre-release publication.
252 ## [2.3.10-2] - 2023-03-18
256 - Fix `exports` syntax for ESM and CommonJS.
258 ## [2.3.10-1] - 2023-03-18
262 - Permit SemVer pre-release publication.
264 ## [2.3.10-0] - 2023-03-18
268 - Fix `exports` syntax for ESM and CommonJS.
270 ## [2.3.9] - 2023-03-18
274 - Introduce ESM module support along with CommonJS one.
278 - Fix brown paper bag bug referencing the same object literal.
280 ## [2.3.8] - 2023-03-18
284 - Switch internal benchmarking code to benny.
285 - Switch to TypeScript 5.x.x.
286 - Switch rollup bundler plugins to core ones.
287 - Switch to TSDoc syntax.
288 - Enforce conventional commits.
292 - Fix random integer generator.
293 - Fix worker choice strategy pool type identification at initialization.
295 ## [2.3.7] - 2022-10-23
299 - Switch to open collective FOSS project funding platform.
300 - Switch to ts-standard linter configuration on TypeScript code.
304 - Fixed missing async on pool execute method.
305 - Fixed typing in TypeScript example.
306 - Fixed types in unit tests.
308 ## [2.3.6] - 2022-10-22
312 - Cleanup pool attributes and methods.
313 - Refine error types thrown.
317 - Fix continuous integration build on windows.
318 - Fix code coverage reporting by using c8 instead of nyc.
320 ## [2.3.5] - 2022-10-21
324 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
325 - Optimize tasks usage lookup implementation.
329 - Fix missed pool event emitter type export.
330 - Fix typedoc documentation generation.
332 ## [2.3.4] - 2022-10-17
336 - Fully automate release process with release-it.
340 - Optimize fair share task scheduling algorithm implementation.
341 - Update benchmarks versus external pools results with latest version.
343 ## [2.3.3] - 2022-10-15
347 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
349 ## [2.3.2] - 2022-10-14
353 - Optimize fair share worker selection strategy implementation.
357 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
359 ## [2.3.1] - 2022-10-13
363 - Pool worker choice strategies:
364 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
365 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
367 ## [2.2.2] - 2022-10-09
371 - Fixed `README.md` file.
373 ## [2.2.1] - 2022-10-08
377 - Dynamic worker choice strategy change at runtime.
379 ## [2.2.0] - 2022-01-05
383 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
385 ## [2.1.0] - 2021-08-29
389 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
393 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
394 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
395 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
396 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
398 ## [2.0.2] - 2021-05-12
402 - Fix `busy` event emission on fixed pool type
404 ## [2.0.1] - 2021-03-16
408 - Check if pool options are properly set.
409 - `busy` event is emitted on all pool types.
411 ## [2.0.0] - 2021-03-01
415 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
419 - `FullPool` event is now renamed to `busy`.
420 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
421 _Find more details on our JSDoc._
423 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
425 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
427 ### Pool options types declaration merge
429 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
431 #### New `export` strategy
435 const DynamicThreadPool = require('poolifier/lib/dynamic')
437 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
440 But you should always prefer just using
443 const { DynamicThreadPool } = require('poolifier')
446 #### New type definitions for input data and response
448 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
449 _This is not a limitation by poolifier but NodeJS._
451 #### Public property replacements
453 `numWorkers` property is now `numberOfWorkers`
455 #### Internal (protected) properties and methods renaming
457 These properties are not intended for end users
459 - `id` => `nextMessageId`
461 These methods are not intended for end users
463 - `_chooseWorker` => `chooseWorker`
464 - `_newWorker` => `createWorker`
465 - `_execute` => `internalExecute`
466 - `_chooseWorker` => `chooseWorker`
467 - `_checkAlive` => `checkAlive`
469 - `_runAsync` => `runAsync`
471 ## [1.1.0] - 2020-05-21
475 - ThreadWorker support async functions as option
476 - Various external library patches
478 ## [1.0.0] - 2020-01-24
482 - FixedThreadPool implementation
483 - DynamicThreadPool implementation
484 - WorkerThread implementation to improve developer experience