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).
10 ## [2.4.13] - 2023-05-08
14 - Fix worker choice strategy options validation.
15 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
17 ## [2.4.12] - 2023-05-06
21 - Support multiple task functions per worker.
22 - Add custom worker weights support to worker choice strategies options.
26 - Use O(1) queue implementation for tasks queueing.
30 - Fix median computation implementation.
31 - Fix fair share worker choice strategy internals update.
33 ## [2.4.11] - 2023-04-23
37 - Optimize free worker finding in worker choice strategies.
39 ## [2.4.10] - 2023-04-15
43 - Fix typescript type definition for worker function: ensure the input data is optional.
44 - Fix typescript type definition for pool execute(): ensure the input data is optional.
46 ## [2.4.9] - 2023-04-15
50 - Add tasks queue enablement runtime setter to pool.
51 - Add tasks queue options runtime setter to pool.
52 - Add worker choice strategy options runtime setter to pool.
56 - Remove the tasks queuing experimental status.
60 - Fix worker function type definition and validation.
61 - Fix worker choice strategy options handling.
63 ## [2.4.8] - 2023-04-12
67 - Fix message between main worker and worker type definition for tasks.
68 - Fix code documentation.
70 ## [2.4.7] - 2023-04-11
74 - Add worker tasks queue options to pool options.
78 - Fix missing documentation.
80 ## [2.4.6] - 2023-04-10
84 - Ensure one task at a time is executed per worker with tasks queueing enabled.
85 - Properly count worker running tasks with tasks queueing enabled.
87 ## [2.4.5] - 2023-04-09
91 - Use monotonic high resolution timer for worker tasks run time.
92 - Add worker tasks median run time to statistics.
93 - Add worker tasks queue (experimental).
95 ## [2.4.4] - 2023-04-07
99 - Add `PoolEvents` enumeration and `PoolEvent` type.
103 - Destroy worker only on alive check.
105 ## [2.4.3] - 2023-04-07
109 - Fix typedoc generation with inheritance.
111 ## [2.4.2] - 2023-04-06
115 - Add `full` event to dynamic pool.
116 - Keep worker choice strategy in memory for conditional reuse.
120 - Fix possible negative worker key at worker removal in worker choice strategies.
122 ## [2.4.1] - 2023-04-05
126 - Optimize worker choice strategy for dynamic pool.
130 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
132 ## [2.4.0] - 2023-04-04
136 - Add `LESS_BUSY` worker choice strategy.
140 - Optimize worker storage in pool.
141 - Optimize worker alive status check.
142 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
143 - Optimize `LESS_USED` worker choice strategy.
144 - Update benchmarks versus external threads pools.
145 - Optimize tasks usage statistics requirements for worker choice strategy.
149 - Ensure trimmable characters are checked at pool initialization.
150 - Fix message id integer overflow.
151 - Fix pool worker removal in worker choice strategy internals.
152 - Fix package publication with pnpm.
154 ## [2.4.0-3] - 2023-04-04
158 - Add `LESS_BUSY` worker choice strategy.
162 - Optimize worker storage in pool.
163 - Optimize worker alive status check.
164 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
165 - Optimize `LESS_USED` worker choice strategy.
166 - Update benchmarks versus external threads pools.
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-2] - 2023-04-03
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.
190 - Ensure trimmable characters are checked at pool initialization.
191 - Fix message id integer overflow.
192 - Fix pool worker removal in worker choice strategy internals.
193 - Fix package publication with pnpm.
195 ## [2.4.0-1] - 2023-04-03
199 - Add `LESS_BUSY` worker choice strategy.
203 - Optimize worker storage in pool.
204 - Optimize worker alive status check.
205 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
206 - Optimize `LESS_USED` worker choice strategy.
210 - Ensure trimmable characters are checked at pool initialization.
211 - Fix message id integer overflow.
212 - Fix pool worker removal in worker choice strategy internals.
214 ## [2.4.0-0] - 2023-04-03
218 - Add `LESS_BUSY` worker choice strategy.
222 - Optimize worker storage in pool.
223 - Optimize worker alive status check.
224 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
225 - Optimize `LESS_USED` worker choice strategy.
229 - Ensure trimmable characters are checked at pool initialization.
230 - Fix message id integer overflow.
231 - Fix pool worker removal in worker choice strategy internals.
233 ## [2.3.10] - 2023-03-18
237 - Fix `exports` syntax for ESM and CommonJS.
241 - Permit SemVer pre-release publication.
243 ## [2.3.10-2] - 2023-03-18
247 - Fix `exports` syntax for ESM and CommonJS.
249 ## [2.3.10-1] - 2023-03-18
253 - Permit SemVer pre-release publication.
255 ## [2.3.10-0] - 2023-03-18
259 - Fix `exports` syntax for ESM and CommonJS.
261 ## [2.3.9] - 2023-03-18
265 - Introduce ESM module support along with CommonJS one.
269 - Fix brown paper bag bug referencing the same object literal.
271 ## [2.3.8] - 2023-03-18
275 - Switch internal benchmarking code to benny.
276 - Switch to TypeScript 5.x.x.
277 - Switch rollup bundler plugins to core ones.
278 - Switch to TSDoc syntax.
279 - Enforce conventional commits.
283 - Fix random integer generator.
284 - Fix worker choice strategy pool type identification at initialization.
286 ## [2.3.7] - 2022-10-23
290 - Switch to open collective FOSS project funding platform.
291 - Switch to ts-standard linter configuration on TypeScript code.
295 - Fixed missing async on pool execute method.
296 - Fixed typing in TypeScript example.
297 - Fixed types in unit tests.
299 ## [2.3.6] - 2022-10-22
303 - Cleanup pool attributes and methods.
304 - Refine error types thrown.
308 - Fix continuous integration build on windows.
309 - Fix code coverage reporting by using c8 instead of nyc.
311 ## [2.3.5] - 2022-10-21
315 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
316 - Optimize tasks usage lookup implementation.
320 - Fix missed pool event emitter type export.
321 - Fix typedoc documentation generation.
323 ## [2.3.4] - 2022-10-17
327 - Fully automate release process with release-it.
331 - Optimize fair share task scheduling algorithm implementation.
332 - Update benchmarks versus external pools results with latest version.
334 ## [2.3.3] - 2022-10-15
338 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
340 ## [2.3.2] - 2022-10-14
344 - Optimize fair share worker selection strategy implementation.
348 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
350 ## [2.3.1] - 2022-10-13
354 - Pool worker choice strategies:
355 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
356 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
358 ## [2.2.2] - 2022-10-09
362 - Fixed `README.md` file.
364 ## [2.2.1] - 2022-10-08
368 - Dynamic worker choice strategy change at runtime.
370 ## [2.2.0] - 2022-01-05
374 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
376 ## [2.1.0] - 2021-08-29
380 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
384 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
385 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
386 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
387 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
389 ## [2.0.2] - 2021-05-12
393 - Fix `busy` event emission on fixed pool type
395 ## [2.0.1] - 2021-03-16
399 - Check if pool options are properly set.
400 - `busy` event is emitted on all pool types.
402 ## [2.0.0] - 2021-03-01
406 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
410 - `FullPool` event is now renamed to `busy`.
411 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
412 _Find more details on our JSDoc._
414 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
416 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
418 ### Pool options types declaration merge
420 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
422 #### New `export` strategy
426 const DynamicThreadPool = require('poolifier/lib/dynamic')
428 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
431 But you should always prefer just using
434 const { DynamicThreadPool } = require('poolifier')
437 #### New type definitions for input data and response
439 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
440 _This is not a limitation by poolifier but NodeJS._
442 #### Public property replacements
444 `numWorkers` property is now `numberOfWorkers`
446 #### Internal (protected) properties and methods renaming
448 These properties are not intended for end users
450 - `id` => `nextMessageId`
452 These methods are not intended for end users
454 - `_chooseWorker` => `chooseWorker`
455 - `_newWorker` => `createWorker`
456 - `_execute` => `internalExecute`
457 - `_chooseWorker` => `chooseWorker`
458 - `_checkAlive` => `checkAlive`
460 - `_runAsync` => `runAsync`
462 ## [1.1.0] - 2020-05-21
466 - ThreadWorker support async functions as option
467 - Various external library patches
469 ## [1.0.0] - 2020-01-24
473 - FixedThreadPool implementation
474 - DynamicThreadPool implementation
475 - WorkerThread implementation to improve developer experience