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 - Optimize free worker finding in worker choice strategies.
14 ## [2.4.10] - 2023-04-15
18 - Fix typescript type definition for worker function: ensure the input data is optional.
19 - Fix typescript type definition for pool execute(): ensure the input data is optional.
21 ## [2.4.9] - 2023-04-15
25 - Add tasks queue enablement runtime setter to pool.
26 - Add tasks queue options runtime setter to pool.
27 - Add worker choice strategy options runtime setter to pool.
31 - Remove the tasks queuing experimental status.
35 - Fix worker function type definition and validation.
36 - Fix worker choice strategy options handling.
38 ## [2.4.8] - 2023-04-12
42 - Fix message between main worker and worker type definition for tasks.
43 - Fix code documentation.
45 ## [2.4.7] - 2023-04-11
49 - Add worker tasks queue options to pool options.
53 - Fix missing documentation.
55 ## [2.4.6] - 2023-04-10
59 - Ensure one task at a time is executed per worker with tasks queueing enabled.
60 - Properly count worker running tasks with tasks queueing enabled.
62 ## [2.4.5] - 2023-04-09
66 - Use monotonic high resolution timer for worker tasks run time.
67 - Add worker tasks median run time to statistics.
68 - Add worker tasks queue (experimental).
70 ## [2.4.4] - 2023-04-07
74 - Add `PoolEvents` enumeration and `PoolEvent` type.
78 - Destroy worker only on alive check.
80 ## [2.4.3] - 2023-04-07
84 - Fix typedoc generation with inheritance.
86 ## [2.4.2] - 2023-04-06
90 - Add `full` event to dynamic pool.
91 - Keep worker choice strategy in memory for conditional reuse.
95 - Fix possible negative worker key at worker removal in worker choice strategies.
97 ## [2.4.1] - 2023-04-05
101 - Optimize worker choice strategy for dynamic pool.
105 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
107 ## [2.4.0] - 2023-04-04
111 - Add `LESS_BUSY` worker choice strategy.
115 - Optimize worker storage in pool.
116 - Optimize worker alive status check.
117 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
118 - Optimize `LESS_USED` worker choice strategy.
119 - Update benchmarks versus external threads pools.
120 - Optimize tasks usage statistics requirements for worker choice strategy.
124 - Ensure trimmable characters are checked at pool initialization.
125 - Fix message id integer overflow.
126 - Fix pool worker removal in worker choice strategy internals.
127 - Fix package publication with pnpm.
129 ## [2.4.0-3] - 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.
145 - Ensure trimmable characters are checked at pool initialization.
146 - Fix message id integer overflow.
147 - Fix pool worker removal in worker choice strategy internals.
148 - Fix package publication with pnpm.
150 ## [2.4.0-2] - 2023-04-03
154 - Add `LESS_BUSY` worker choice strategy.
158 - Optimize worker storage in pool.
159 - Optimize worker alive status check.
160 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
161 - Optimize `LESS_USED` worker choice strategy.
165 - Ensure trimmable characters are checked at pool initialization.
166 - Fix message id integer overflow.
167 - Fix pool worker removal in worker choice strategy internals.
168 - Fix package publication with pnpm.
170 ## [2.4.0-1] - 2023-04-03
174 - Add `LESS_BUSY` worker choice strategy.
178 - Optimize worker storage in pool.
179 - Optimize worker alive status check.
180 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
181 - Optimize `LESS_USED` worker choice strategy.
185 - Ensure trimmable characters are checked at pool initialization.
186 - Fix message id integer overflow.
187 - Fix pool worker removal in worker choice strategy internals.
189 ## [2.4.0-0] - 2023-04-03
193 - Add `LESS_BUSY` worker choice strategy.
197 - Optimize worker storage in pool.
198 - Optimize worker alive status check.
199 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
200 - Optimize `LESS_USED` worker choice strategy.
204 - Ensure trimmable characters are checked at pool initialization.
205 - Fix message id integer overflow.
206 - Fix pool worker removal in worker choice strategy internals.
208 ## [2.3.10] - 2023-03-18
212 - Fix `exports` syntax for ESM and CommonJS.
216 - Permit SemVer pre-release publication.
218 ## [2.3.10-2] - 2023-03-18
222 - Fix `exports` syntax for ESM and CommonJS.
224 ## [2.3.10-1] - 2023-03-18
228 - Permit SemVer pre-release publication.
230 ## [2.3.10-0] - 2023-03-18
234 - Fix `exports` syntax for ESM and CommonJS.
236 ## [2.3.9] - 2023-03-18
240 - Introduce ESM module support along with CommonJS one.
244 - Fix brown paper bag bug referencing the same object literal.
246 ## [2.3.8] - 2023-03-18
250 - Switch internal benchmarking code to benny.
251 - Switch to TypeScript 5.x.x.
252 - Switch rollup bundler plugins to core ones.
253 - Switch to TSDoc syntax.
254 - Enforce conventional commits.
258 - Fix random integer generator.
259 - Fix worker choice strategy pool type identification at initialization.
261 ## [2.3.7] - 2022-10-23
265 - Switch to open collective FOSS project funding platform.
266 - Switch to ts-standard linter configuration on TypeScript code.
270 - Fixed missing async on pool execute method.
271 - Fixed typing in TypeScript example.
272 - Fixed types in unit tests.
274 ## [2.3.6] - 2022-10-22
278 - Cleanup pool attributes and methods.
279 - Refine error types thrown.
283 - Fix continuous integration build on windows.
284 - Fix code coverage reporting by using c8 instead of nyc.
286 ## [2.3.5] - 2022-10-21
290 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
291 - Optimize tasks usage lookup implementation.
295 - Fix missed pool event emitter type export.
296 - Fix typedoc documentation generation.
298 ## [2.3.4] - 2022-10-17
302 - Fully automate release process with release-it.
306 - Optimize fair share task scheduling algorithm implementation.
307 - Update benchmarks versus external pools results with latest version.
309 ## [2.3.3] - 2022-10-15
313 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
315 ## [2.3.2] - 2022-10-14
319 - Optimize fair share worker selection strategy implementation.
323 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
325 ## [2.3.1] - 2022-10-13
329 - Pool worker choice strategies:
330 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
331 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
333 ## [2.2.2] - 2022-10-09
337 - Fixed `README.md` file.
339 ## [2.2.1] - 2022-10-08
343 - Dynamic worker choice strategy change at runtime.
345 ## [2.2.0] - 2022-01-05
349 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
351 ## [2.1.0] - 2021-08-29
355 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
359 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
360 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
361 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
362 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
364 ## [2.0.2] - 2021-05-12
368 - Fix `busy` event emission on fixed pool type
370 ## [2.0.1] - 2021-03-16
374 - Check if pool options are properly set.
375 - `busy` event is emitted on all pool types.
377 ## [2.0.0] - 2021-03-01
381 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
385 - `FullPool` event is now renamed to `busy`.
386 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
387 _Find more details on our JSDoc._
389 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
391 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
393 ### Pool options types declaration merge
395 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
397 #### New `export` strategy
401 const DynamicThreadPool = require('poolifier/lib/dynamic')
403 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
406 But you should always prefer just using
409 const { DynamicThreadPool } = require('poolifier')
412 #### New type definitions for input data and response
414 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
415 _This is not a limitation by poolifier but NodeJS._
417 #### Public property replacements
419 `numWorkers` property is now `numberOfWorkers`
421 #### Internal (protected) properties and methods renaming
423 These properties are not intended for end users
425 - `id` => `nextMessageId`
427 These methods are not intended for end users
429 - `_chooseWorker` => `chooseWorker`
430 - `_newWorker` => `createWorker`
431 - `_execute` => `internalExecute`
432 - `_chooseWorker` => `chooseWorker`
433 - `_checkAlive` => `checkAlive`
435 - `_runAsync` => `runAsync`
437 ## [1.1.0] - 2020-05-21
441 - ThreadWorker support async functions as option
442 - Various external library patches
444 ## [1.0.0] - 2020-01-24
448 - FixedThreadPool implementation
449 - DynamicThreadPool implementation
450 - WorkerThread implementation to improve developer experience