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 - Support multiple task functions per worker.
13 - Add custom worker weights support to worker choice strategies options.
17 - Use O(1) queue implementation for tasks queueing.
19 ## [2.4.11] - 2023-04-23
23 - Optimize free worker finding in worker choice strategies.
25 ## [2.4.10] - 2023-04-15
29 - Fix typescript type definition for worker function: ensure the input data is optional.
30 - Fix typescript type definition for pool execute(): ensure the input data is optional.
32 ## [2.4.9] - 2023-04-15
36 - Add tasks queue enablement runtime setter to pool.
37 - Add tasks queue options runtime setter to pool.
38 - Add worker choice strategy options runtime setter to pool.
42 - Remove the tasks queuing experimental status.
46 - Fix worker function type definition and validation.
47 - Fix worker choice strategy options handling.
49 ## [2.4.8] - 2023-04-12
53 - Fix message between main worker and worker type definition for tasks.
54 - Fix code documentation.
56 ## [2.4.7] - 2023-04-11
60 - Add worker tasks queue options to pool options.
64 - Fix missing documentation.
66 ## [2.4.6] - 2023-04-10
70 - Ensure one task at a time is executed per worker with tasks queueing enabled.
71 - Properly count worker running tasks with tasks queueing enabled.
73 ## [2.4.5] - 2023-04-09
77 - Use monotonic high resolution timer for worker tasks run time.
78 - Add worker tasks median run time to statistics.
79 - Add worker tasks queue (experimental).
81 ## [2.4.4] - 2023-04-07
85 - Add `PoolEvents` enumeration and `PoolEvent` type.
89 - Destroy worker only on alive check.
91 ## [2.4.3] - 2023-04-07
95 - Fix typedoc generation with inheritance.
97 ## [2.4.2] - 2023-04-06
101 - Add `full` event to dynamic pool.
102 - Keep worker choice strategy in memory for conditional reuse.
106 - Fix possible negative worker key at worker removal in worker choice strategies.
108 ## [2.4.1] - 2023-04-05
112 - Optimize worker choice strategy for dynamic pool.
116 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
118 ## [2.4.0] - 2023-04-04
122 - Add `LESS_BUSY` worker choice strategy.
126 - Optimize worker storage in pool.
127 - Optimize worker alive status check.
128 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
129 - Optimize `LESS_USED` worker choice strategy.
130 - Update benchmarks versus external threads pools.
131 - Optimize tasks usage statistics requirements for worker choice strategy.
135 - Ensure trimmable characters are checked at pool initialization.
136 - Fix message id integer overflow.
137 - Fix pool worker removal in worker choice strategy internals.
138 - Fix package publication with pnpm.
140 ## [2.4.0-3] - 2023-04-04
144 - Add `LESS_BUSY` worker choice strategy.
148 - Optimize worker storage in pool.
149 - Optimize worker alive status check.
150 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
151 - Optimize `LESS_USED` worker choice strategy.
152 - Update benchmarks versus external threads pools.
156 - Ensure trimmable characters are checked at pool initialization.
157 - Fix message id integer overflow.
158 - Fix pool worker removal in worker choice strategy internals.
159 - Fix package publication with pnpm.
161 ## [2.4.0-2] - 2023-04-03
165 - Add `LESS_BUSY` worker choice strategy.
169 - Optimize worker storage in pool.
170 - Optimize worker alive status check.
171 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
172 - Optimize `LESS_USED` worker choice strategy.
176 - Ensure trimmable characters are checked at pool initialization.
177 - Fix message id integer overflow.
178 - Fix pool worker removal in worker choice strategy internals.
179 - Fix package publication with pnpm.
181 ## [2.4.0-1] - 2023-04-03
185 - Add `LESS_BUSY` worker choice strategy.
189 - Optimize worker storage in pool.
190 - Optimize worker alive status check.
191 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
192 - Optimize `LESS_USED` worker choice strategy.
196 - Ensure trimmable characters are checked at pool initialization.
197 - Fix message id integer overflow.
198 - Fix pool worker removal in worker choice strategy internals.
200 ## [2.4.0-0] - 2023-04-03
204 - Add `LESS_BUSY` worker choice strategy.
208 - Optimize worker storage in pool.
209 - Optimize worker alive status check.
210 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
211 - Optimize `LESS_USED` worker choice strategy.
215 - Ensure trimmable characters are checked at pool initialization.
216 - Fix message id integer overflow.
217 - Fix pool worker removal in worker choice strategy internals.
219 ## [2.3.10] - 2023-03-18
223 - Fix `exports` syntax for ESM and CommonJS.
227 - Permit SemVer pre-release publication.
229 ## [2.3.10-2] - 2023-03-18
233 - Fix `exports` syntax for ESM and CommonJS.
235 ## [2.3.10-1] - 2023-03-18
239 - Permit SemVer pre-release publication.
241 ## [2.3.10-0] - 2023-03-18
245 - Fix `exports` syntax for ESM and CommonJS.
247 ## [2.3.9] - 2023-03-18
251 - Introduce ESM module support along with CommonJS one.
255 - Fix brown paper bag bug referencing the same object literal.
257 ## [2.3.8] - 2023-03-18
261 - Switch internal benchmarking code to benny.
262 - Switch to TypeScript 5.x.x.
263 - Switch rollup bundler plugins to core ones.
264 - Switch to TSDoc syntax.
265 - Enforce conventional commits.
269 - Fix random integer generator.
270 - Fix worker choice strategy pool type identification at initialization.
272 ## [2.3.7] - 2022-10-23
276 - Switch to open collective FOSS project funding platform.
277 - Switch to ts-standard linter configuration on TypeScript code.
281 - Fixed missing async on pool execute method.
282 - Fixed typing in TypeScript example.
283 - Fixed types in unit tests.
285 ## [2.3.6] - 2022-10-22
289 - Cleanup pool attributes and methods.
290 - Refine error types thrown.
294 - Fix continuous integration build on windows.
295 - Fix code coverage reporting by using c8 instead of nyc.
297 ## [2.3.5] - 2022-10-21
301 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
302 - Optimize tasks usage lookup implementation.
306 - Fix missed pool event emitter type export.
307 - Fix typedoc documentation generation.
309 ## [2.3.4] - 2022-10-17
313 - Fully automate release process with release-it.
317 - Optimize fair share task scheduling algorithm implementation.
318 - Update benchmarks versus external pools results with latest version.
320 ## [2.3.3] - 2022-10-15
324 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
326 ## [2.3.2] - 2022-10-14
330 - Optimize fair share worker selection strategy implementation.
334 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
336 ## [2.3.1] - 2022-10-13
340 - Pool worker choice strategies:
341 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
342 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
344 ## [2.2.2] - 2022-10-09
348 - Fixed `README.md` file.
350 ## [2.2.1] - 2022-10-08
354 - Dynamic worker choice strategy change at runtime.
356 ## [2.2.0] - 2022-01-05
360 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
362 ## [2.1.0] - 2021-08-29
366 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
370 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
371 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
372 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
373 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
375 ## [2.0.2] - 2021-05-12
379 - Fix `busy` event emission on fixed pool type
381 ## [2.0.1] - 2021-03-16
385 - Check if pool options are properly set.
386 - `busy` event is emitted on all pool types.
388 ## [2.0.0] - 2021-03-01
392 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
396 - `FullPool` event is now renamed to `busy`.
397 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
398 _Find more details on our JSDoc._
400 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
402 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
404 ### Pool options types declaration merge
406 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
408 #### New `export` strategy
412 const DynamicThreadPool = require('poolifier/lib/dynamic')
414 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
417 But you should always prefer just using
420 const { DynamicThreadPool } = require('poolifier')
423 #### New type definitions for input data and response
425 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
426 _This is not a limitation by poolifier but NodeJS._
428 #### Public property replacements
430 `numWorkers` property is now `numberOfWorkers`
432 #### Internal (protected) properties and methods renaming
434 These properties are not intended for end users
436 - `id` => `nextMessageId`
438 These methods are not intended for end users
440 - `_chooseWorker` => `chooseWorker`
441 - `_newWorker` => `createWorker`
442 - `_execute` => `internalExecute`
443 - `_chooseWorker` => `chooseWorker`
444 - `_checkAlive` => `checkAlive`
446 - `_runAsync` => `runAsync`
448 ## [1.1.0] - 2020-05-21
452 - ThreadWorker support async functions as option
453 - Various external library patches
455 ## [1.0.0] - 2020-01-24
459 - FixedThreadPool implementation
460 - DynamicThreadPool implementation
461 - WorkerThread implementation to improve developer experience