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 - Add tasks queue enablement runtime setter to pool.
13 - Add tasks queue options runtime setter to pool.
14 - Add worker choice strategy options runtime setter to pool.
18 - Remove the tasks queuing experimental status.
22 - Fix worker function type definition and validation.
23 - Fix worker choice strategy options handling.
25 ## [2.4.8] - 2023-04-12
29 - Fix message between main worker and worker type definition for tasks.
30 - Fix code documentation.
32 ## [2.4.7] - 2023-04-11
36 - Add worker tasks queue options to pool options.
40 - Fix missing documentation.
42 ## [2.4.6] - 2023-04-10
46 - Ensure one task at a time is executed per worker with tasks queueing enabled.
47 - Properly count worker running tasks with tasks queueing enabled.
49 ## [2.4.5] - 2023-04-09
53 - Use monotonic high resolution timer for worker tasks run time.
54 - Add worker tasks median run time to statistics.
55 - Add worker tasks queue (experimental).
57 ## [2.4.4] - 2023-04-07
61 - Add `PoolEvents` enumeration and `PoolEvent` type.
65 - Destroy worker only on alive check.
67 ## [2.4.3] - 2023-04-07
71 - Fix typedoc generation with inheritance.
73 ## [2.4.2] - 2023-04-06
77 - Add `full` event to dynamic pool.
78 - Keep worker choice strategy in memory for conditional reuse.
82 - Fix possible negative worker key at worker removal in worker choice strategies.
84 ## [2.4.1] - 2023-04-05
88 - Optimize worker choice strategy for dynamic pool.
92 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
94 ## [2.4.0] - 2023-04-04
98 - Add `LESS_BUSY` worker choice strategy.
102 - Optimize worker storage in pool.
103 - Optimize worker alive status check.
104 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
105 - Optimize `LESS_USED` worker choice strategy.
106 - Update benchmarks versus external threads pools.
107 - Optimize tasks usage statistics requirements for worker choice strategy.
111 - Ensure trimmable characters are checked at pool initialization.
112 - Fix message id integer overflow.
113 - Fix pool worker removal in worker choice strategy internals.
114 - Fix package publication with pnpm.
116 ## [2.4.0-3] - 2023-04-04
120 - Add `LESS_BUSY` worker choice strategy.
124 - Optimize worker storage in pool.
125 - Optimize worker alive status check.
126 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
127 - Optimize `LESS_USED` worker choice strategy.
128 - Update benchmarks versus external threads pools.
132 - Ensure trimmable characters are checked at pool initialization.
133 - Fix message id integer overflow.
134 - Fix pool worker removal in worker choice strategy internals.
135 - Fix package publication with pnpm.
137 ## [2.4.0-2] - 2023-04-03
141 - Add `LESS_BUSY` worker choice strategy.
145 - Optimize worker storage in pool.
146 - Optimize worker alive status check.
147 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
148 - Optimize `LESS_USED` worker choice strategy.
152 - Ensure trimmable characters are checked at pool initialization.
153 - Fix message id integer overflow.
154 - Fix pool worker removal in worker choice strategy internals.
155 - Fix package publication with pnpm.
157 ## [2.4.0-1] - 2023-04-03
161 - Add `LESS_BUSY` worker choice strategy.
165 - Optimize worker storage in pool.
166 - Optimize worker alive status check.
167 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
168 - Optimize `LESS_USED` worker choice strategy.
172 - Ensure trimmable characters are checked at pool initialization.
173 - Fix message id integer overflow.
174 - Fix pool worker removal in worker choice strategy internals.
176 ## [2.4.0-0] - 2023-04-03
180 - Add `LESS_BUSY` worker choice strategy.
184 - Optimize worker storage in pool.
185 - Optimize worker alive status check.
186 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
187 - Optimize `LESS_USED` worker choice strategy.
191 - Ensure trimmable characters are checked at pool initialization.
192 - Fix message id integer overflow.
193 - Fix pool worker removal in worker choice strategy internals.
195 ## [2.3.10] - 2023-03-18
199 - Fix `exports` syntax for ESM and CommonJS.
203 - Permit SemVer pre-release publication.
205 ## [2.3.10-2] - 2023-03-18
209 - Fix `exports` syntax for ESM and CommonJS.
211 ## [2.3.10-1] - 2023-03-18
215 - Permit SemVer pre-release publication.
217 ## [2.3.10-0] - 2023-03-18
221 - Fix `exports` syntax for ESM and CommonJS.
223 ## [2.3.9] - 2023-03-18
227 - Introduce ESM module support along with CommonJS one.
231 - Fix brown paper bag bug referencing the same object literal.
233 ## [2.3.8] - 2023-03-18
237 - Switch internal benchmarking code to benny.
238 - Switch to TypeScript 5.x.x.
239 - Switch rollup bundler plugins to core ones.
240 - Switch to TSDoc syntax.
241 - Enforce conventional commits.
245 - Fix random integer generator.
246 - Fix worker choice strategy pool type identification at initialization.
248 ## [2.3.7] - 2022-10-23
252 - Switch to open collective FOSS project funding platform.
253 - Switch to ts-standard linter configuration on TypeScript code.
257 - Fixed missing async on pool execute method.
258 - Fixed typing in TypeScript example.
259 - Fixed types in unit tests.
261 ## [2.3.6] - 2022-10-22
265 - Cleanup pool attributes and methods.
266 - Refine error types thrown.
270 - Fix continuous integration build on windows.
271 - Fix code coverage reporting by using c8 instead of nyc.
273 ## [2.3.5] - 2022-10-21
277 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
278 - Optimize tasks usage lookup implementation.
282 - Fix missed pool event emitter type export.
283 - Fix typedoc documentation generation.
285 ## [2.3.4] - 2022-10-17
289 - Fully automate release process with release-it.
293 - Optimize fair share task scheduling algorithm implementation.
294 - Update benchmarks versus external pools results with latest version.
296 ## [2.3.3] - 2022-10-15
300 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
302 ## [2.3.2] - 2022-10-14
306 - Optimize fair share worker selection strategy implementation.
310 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
312 ## [2.3.1] - 2022-10-13
316 - Pool worker choice strategies:
317 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
318 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
320 ## [2.2.2] - 2022-10-09
324 - Fixed `README.md` file.
326 ## [2.2.1] - 2022-10-08
330 - Dynamic worker choice strategy change at runtime.
332 ## [2.2.0] - 2022-01-05
336 - Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
338 ## [2.1.0] - 2021-08-29
342 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
346 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
347 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
348 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
349 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
351 ## [2.0.2] - 2021-05-12
355 - Fix `busy` event emission on fixed pool type
357 ## [2.0.1] - 2021-03-16
361 - Check if pool options are properly set.
362 - `busy` event is emitted on all pool types.
364 ## [2.0.0] - 2021-03-01
368 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
372 - `FullPool` event is now renamed to `busy`.
373 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
374 _Find more details on our JSDoc._
376 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
378 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
380 ### Pool options types declaration merge
382 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
384 #### New `export` strategy
388 const DynamicThreadPool = require('poolifier/lib/dynamic')
390 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
393 But you should always prefer just using
396 const { DynamicThreadPool } = require('poolifier')
399 #### New type definitions for input data and response
401 For cluster worker and worker-thread pools, you can now only send and receive serializable data.
402 _This is not a limitation by poolifier but NodeJS._
404 #### Public property replacements
406 `numWorkers` property is now `numberOfWorkers`
408 #### Internal (protected) properties and methods renaming
410 These properties are not intended for end users
412 - `id` => `nextMessageId`
414 These methods are not intended for end users
416 - `_chooseWorker` => `chooseWorker`
417 - `_newWorker` => `createWorker`
418 - `_execute` => `internalExecute`
419 - `_chooseWorker` => `chooseWorker`
420 - `_checkAlive` => `checkAlive`
422 - `_runAsync` => `runAsync`
424 ## [1.1.0] - 2020-05-21
428 - ThreadWorker support async functions as option
429 - Various external library patches
431 ## [1.0.0] - 2020-01-24
435 - FixedThreadPool implementation
436 - DynamicThreadPool implementation
437 - WorkerThread implementation to improve developer experience