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 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
14 ## [2.4.12] - 2023-05-06
18 - Support multiple task functions per worker.
19 - Add custom worker weights support to worker choice strategies options.
23 - Use O(1) queue implementation for tasks queueing.
27 - Fix median computation implementation.
28 - Fix fair share worker choice strategy internals update.
30 ## [2.4.11] - 2023-04-23
34 - Optimize free worker finding in worker choice strategies.
36 ## [2.4.10] - 2023-04-15
40 - Fix typescript type definition for worker function: ensure the input data is optional.
41 - Fix typescript type definition for pool execute(): ensure the input data is optional.
43 ## [2.4.9] - 2023-04-15
47 - Add tasks queue enablement runtime setter to pool.
48 - Add tasks queue options runtime setter to pool.
49 - Add worker choice strategy options runtime setter to pool.
53 - Remove the tasks queuing experimental status.
57 - Fix worker function type definition and validation.
58 - Fix worker choice strategy options handling.
60 ## [2.4.8] - 2023-04-12
64 - Fix message between main worker and worker type definition for tasks.
65 - Fix code documentation.
67 ## [2.4.7] - 2023-04-11
71 - Add worker tasks queue options to pool options.
75 - Fix missing documentation.
77 ## [2.4.6] - 2023-04-10
81 - Ensure one task at a time is executed per worker with tasks queueing enabled.
82 - Properly count worker running tasks with tasks queueing enabled.
84 ## [2.4.5] - 2023-04-09
88 - Use monotonic high resolution timer for worker tasks run time.
89 - Add worker tasks median run time to statistics.
90 - Add worker tasks queue (experimental).
92 ## [2.4.4] - 2023-04-07
96 - Add `PoolEvents` enumeration and `PoolEvent` type.
100 - Destroy worker only on alive check.
102 ## [2.4.3] - 2023-04-07
106 - Fix typedoc generation with inheritance.
108 ## [2.4.2] - 2023-04-06
112 - Add `full` event to dynamic pool.
113 - Keep worker choice strategy in memory for conditional reuse.
117 - Fix possible negative worker key at worker removal in worker choice strategies.
119 ## [2.4.1] - 2023-04-05
123 - Optimize worker choice strategy for dynamic pool.
127 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
129 ## [2.4.0] - 2023-04-04
133 - Add `LESS_BUSY` worker choice strategy.
137 - Optimize worker storage in pool.
138 - Optimize worker alive status check.
139 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
140 - Optimize `LESS_USED` worker choice strategy.
141 - Update benchmarks versus external threads pools.
142 - Optimize tasks usage statistics requirements for worker choice strategy.
146 - Ensure trimmable characters are checked at pool initialization.
147 - Fix message id integer overflow.
148 - Fix pool worker removal in worker choice strategy internals.
149 - Fix package publication with pnpm.
151 ## [2.4.0-3] - 2023-04-04
155 - Add `LESS_BUSY` worker choice strategy.
159 - Optimize worker storage in pool.
160 - Optimize worker alive status check.
161 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
162 - Optimize `LESS_USED` worker choice strategy.
163 - Update benchmarks versus external threads pools.
167 - Ensure trimmable characters are checked at pool initialization.
168 - Fix message id integer overflow.
169 - Fix pool worker removal in worker choice strategy internals.
170 - Fix package publication with pnpm.
172 ## [2.4.0-2] - 2023-04-03
176 - Add `LESS_BUSY` worker choice strategy.
180 - Optimize worker storage in pool.
181 - Optimize worker alive status check.
182 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
183 - Optimize `LESS_USED` worker choice strategy.
187 - Ensure trimmable characters are checked at pool initialization.
188 - Fix message id integer overflow.
189 - Fix pool worker removal in worker choice strategy internals.
190 - Fix package publication with pnpm.
192 ## [2.4.0-1] - 2023-04-03
196 - Add `LESS_BUSY` worker choice strategy.
200 - Optimize worker storage in pool.
201 - Optimize worker alive status check.
202 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
203 - Optimize `LESS_USED` worker choice strategy.
207 - Ensure trimmable characters are checked at pool initialization.
208 - Fix message id integer overflow.
209 - Fix pool worker removal in worker choice strategy internals.
211 ## [2.4.0-0] - 2023-04-03
215 - Add `LESS_BUSY` worker choice strategy.
219 - Optimize worker storage in pool.
220 - Optimize worker alive status check.
221 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
222 - Optimize `LESS_USED` worker choice strategy.
226 - Ensure trimmable characters are checked at pool initialization.
227 - Fix message id integer overflow.
228 - Fix pool worker removal in worker choice strategy internals.
230 ## [2.3.10] - 2023-03-18
234 - Fix `exports` syntax for ESM and CommonJS.
238 - Permit SemVer pre-release publication.
240 ## [2.3.10-2] - 2023-03-18
244 - Fix `exports` syntax for ESM and CommonJS.
246 ## [2.3.10-1] - 2023-03-18
250 - Permit SemVer pre-release publication.
252 ## [2.3.10-0] - 2023-03-18
256 - Fix `exports` syntax for ESM and CommonJS.
258 ## [2.3.9] - 2023-03-18
262 - Introduce ESM module support along with CommonJS one.
266 - Fix brown paper bag bug referencing the same object literal.
268 ## [2.3.8] - 2023-03-18
272 - Switch internal benchmarking code to benny.
273 - Switch to TypeScript 5.x.x.
274 - Switch rollup bundler plugins to core ones.
275 - Switch to TSDoc syntax.
276 - Enforce conventional commits.
280 - Fix random integer generator.
281 - Fix worker choice strategy pool type identification at initialization.
283 ## [2.3.7] - 2022-10-23
287 - Switch to open collective FOSS project funding platform.
288 - Switch to ts-standard linter configuration on TypeScript code.
292 - Fixed missing async on pool execute method.
293 - Fixed typing in TypeScript example.
294 - Fixed types in unit tests.
296 ## [2.3.6] - 2022-10-22
300 - Cleanup pool attributes and methods.
301 - Refine error types thrown.
305 - Fix continuous integration build on windows.
306 - Fix code coverage reporting by using c8 instead of nyc.
308 ## [2.3.5] - 2022-10-21
312 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
313 - Optimize tasks usage lookup implementation.
317 - Fix missed pool event emitter type export.
318 - Fix typedoc documentation generation.
320 ## [2.3.4] - 2022-10-17
324 - Fully automate release process with release-it.
328 - Optimize fair share task scheduling algorithm implementation.
329 - Update benchmarks versus external pools results with latest version.
331 ## [2.3.3] - 2022-10-15
335 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
337 ## [2.3.2] - 2022-10-14
341 - Optimize fair share worker selection strategy implementation.
345 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
347 ## [2.3.1] - 2022-10-13
351 - Pool worker choice strategies:
352 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
353 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
355 ## [2.2.2] - 2022-10-09
359 - Fixed `README.md` file.
361 ## [2.2.1] - 2022-10-08
365 - Dynamic worker choice strategy change at runtime.
367 ## [2.2.0] - 2022-01-05
371 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
373 ## [2.1.0] - 2021-08-29
377 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
381 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
382 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
383 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
384 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
386 ## [2.0.2] - 2021-05-12
390 - Fix `busy` event emission on fixed pool type
392 ## [2.0.1] - 2021-03-16
396 - Check if pool options are properly set.
397 - `busy` event is emitted on all pool types.
399 ## [2.0.0] - 2021-03-01
403 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
407 - `FullPool` event is now renamed to `busy`.
408 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
409 _Find more details on our JSDoc._
411 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
413 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
415 ### Pool options types declaration merge
417 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
419 #### New `export` strategy
423 const DynamicThreadPool = require('poolifier/lib/dynamic')
425 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
428 But you should always prefer just using
431 const { DynamicThreadPool } = require('poolifier')
434 #### New type definitions for input data and response
436 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
437 _This is not a limitation by poolifier but NodeJS._
439 #### Public property replacements
441 `numWorkers` property is now `numberOfWorkers`
443 #### Internal (protected) properties and methods renaming
445 These properties are not intended for end users
447 - `id` => `nextMessageId`
449 These methods are not intended for end users
451 - `_chooseWorker` => `chooseWorker`
452 - `_newWorker` => `createWorker`
453 - `_execute` => `internalExecute`
454 - `_chooseWorker` => `chooseWorker`
455 - `_checkAlive` => `checkAlive`
457 - `_runAsync` => `runAsync`
459 ## [1.1.0] - 2020-05-21
463 - ThreadWorker support async functions as option
464 - Various external library patches
466 ## [1.0.0] - 2020-01-24
470 - FixedThreadPool implementation
471 - DynamicThreadPool implementation
472 - WorkerThread implementation to improve developer experience