chore: generate documentation
[poolifier.git] / CHANGELOG.md
CommitLineData
522eea03 1# Changelog
2
3All notable changes to this project will be documented in this file.
4
d4abc60a 5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
522eea03 6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
45a5a54c
JB
8## [Unreleased]
9
b6b32453
JB
10### Added
11
12- Add Event Loop Utilization (ELU) statistics to worker tasks usage.
13
14### Changed
15
16- Compute statistics at the worker level only if needed.
90082c8c 17- Add `worker-threads` options to thread pool options.
b6b32453 18
272d4d8f
JB
19### Fixed
20
21- Make the `LEAST_BUSY` strategy only relies on task runtime.
22
ed47fb3d
JB
23## [2.5.3] - 2023-06-04
24
89a4abfd
JB
25### Changed
26
27- Refine pool information content.
b4213b7f 28- Limit pool internals public exposure.
89a4abfd 29
8a9febf5
JB
30## [2.5.2] - 2023-06-02
31
91ee39ed
JB
32### Added
33
34- Add `taskError` pool event for task execution error.
6b27d407 35- Add pool information `info` property to pool.
91ee39ed
JB
36- Emit pool information on `busy` and `full` pool events.
37
8babb151
JB
38## [2.5.1] - 2023-06-01
39
0e05c4dc
JB
40### Added
41
1f68cede 42- Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
91ee39ed 43- Add `error` pool event for uncaught worker error.
0e05c4dc 44
a8766181
JB
45## [2.5.0] - 2023-05-31
46
e4543b14
JB
47### Added
48
49- Switch pool event emitter to `EventEmitterAsyncResource`.
6da80d38 50- Add tasks wait time accounting in per worker tasks usage.
71002f09 51- Add interleaved weighted round robin worker choice strategy (experimental).
e4543b14
JB
52
53### Changed
54
55- Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
56
570efb11
JB
57## [2.4.14] - 2023-05-09
58
b0f28bad
JB
59### Fixed
60
61- Ensure no undefined task runtime can land in the tasks history.
62- Fix median computation implementation once again.
63
110b6d13
JB
64### Added
65
66- Unit tests for median and queue implementations.
67
72584880
JB
68## [2.4.13] - 2023-05-08
69
b0d6ed8f
JB
70### Fixed
71
e3058615 72- Fix worker choice strategy options validation.
b0d6ed8f
JB
73- Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
74
06140c32
JB
75## [2.4.12] - 2023-05-06
76
a86b6df1
JB
77### Added
78
79- Support multiple task functions per worker.
08f3f44c 80- Add custom worker weights support to worker choice strategies options.
a86b6df1 81
29ee7e9a
JB
82### Changed
83
84- Use O(1) queue implementation for tasks queueing.
85
0682ba15
JB
86### Fixed
87
88- Fix median computation implementation.
89- Fix fair share worker choice strategy internals update.
90
936d53ec
JB
91## [2.4.11] - 2023-04-23
92
cb70b19d
JB
93### Changed
94
95- Optimize free worker finding in worker choice strategies.
96
15bb637a
JB
97## [2.4.10] - 2023-04-15
98
ef41a6e6
JB
99### Fixed
100
101- Fix typescript type definition for worker function: ensure the input data is optional.
102- Fix typescript type definition for pool execute(): ensure the input data is optional.
103
181eb2b4
JB
104## [2.4.9] - 2023-04-15
105
a20f0ba5
JB
106### Added
107
108- Add tasks queue enablement runtime setter to pool.
109- Add tasks queue options runtime setter to pool.
110- Add worker choice strategy options runtime setter to pool.
111
112### Changed
113
114- Remove the tasks queuing experimental status.
115
d4aeae5a
JB
116### Fixed
117
118- Fix worker function type definition and validation.
2fc5cae3 119- Fix worker choice strategy options handling.
d4aeae5a 120
1d9e7023
JB
121## [2.4.8] - 2023-04-12
122
f9b4bbf8
JB
123### Fixed
124
125- Fix message between main worker and worker type definition for tasks.
126- Fix code documentation.
127
12ae3210
JB
128## [2.4.7] - 2023-04-11
129
7171d33f
JB
130### Added
131
132- Add worker tasks queue options to pool options.
133
e8bd29ce
JB
134### Fixed
135
136- Fix missing documentation.
137
42c7bc10
JB
138## [2.4.6] - 2023-04-10
139
681196cc
JB
140### Fixed
141
142- Ensure one task at a time is executed per worker with tasks queueing enabled.
76545787 143- Properly count worker running tasks with tasks queueing enabled.
681196cc 144
54d360e3
JB
145## [2.4.5] - 2023-04-09
146
3fafb1b2
JB
147### Added
148
9e775f96
JB
149- Use monotonic high resolution timer for worker tasks runtime.
150- Add worker tasks median runtime to statistics.
ff733df7 151- Add worker tasks queue (experimental).
3fafb1b2 152
92fa3eb6
JB
153## [2.4.4] - 2023-04-07
154
aee46736
JB
155### Added
156
157- Add `PoolEvents` enumeration and `PoolEvent` type.
158
36b5e78f
JB
159### Fixed
160
ff0c2b3e 161- Destroy worker only on alive check.
36b5e78f 162
9fb0f324
JB
163## [2.4.3] - 2023-04-07
164
28cf3617
JB
165### Fixed
166
167- Fix typedoc generation with inheritance.
168
848f0f27
JB
169## [2.4.2] - 2023-04-06
170
164d950a
JB
171### Added
172
173- Add `full` event to dynamic pool.
32417142 174- Keep worker choice strategy in memory for conditional reuse.
164d950a 175
78ab2555
JB
176### Fixed
177
178- Fix possible negative worker key at worker removal in worker choice strategies.
179
79aafe9f
JB
180## [2.4.1] - 2023-04-05
181
9cd39dd4
JB
182### Changed
183
184- Optimize worker choice strategy for dynamic pool.
185
965415bb
JB
186### Fixed
187
188- Ensure dynamic pool does not alter worker choice strategy expected behavior.
189
d8b60b1c
JB
190## [2.4.0] - 2023-04-04
191
c6bd2650
JB
192### Added
193
194- Add `LESS_BUSY` worker choice strategy.
195
196### Changed
197
198- Optimize worker storage in pool.
199- Optimize worker alive status check.
200- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
201- Optimize `LESS_USED` worker choice strategy.
202- Update benchmarks versus external threads pools.
203- Optimize tasks usage statistics requirements for worker choice strategy.
204
205### Fixed
206
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.
210- Fix package publication with pnpm.
211
d0a3f018
JB
212## [2.4.0-3] - 2023-04-04
213
b2ede285
JB
214### Added
215
216- Add `LESS_BUSY` worker choice strategy.
217
218### Changed
219
220- Optimize worker storage in pool.
221- Optimize worker alive status check.
222- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
223- Optimize `LESS_USED` worker choice strategy.
224- Update benchmarks versus external threads pools.
225
226### Fixed
227
228- Ensure trimmable characters are checked at pool initialization.
229- Fix message id integer overflow.
230- Fix pool worker removal in worker choice strategy internals.
231- Fix package publication with pnpm.
232
a015ea40
JB
233## [2.4.0-2] - 2023-04-03
234
698f4bbc
JB
235### Added
236
237- Add `LESS_BUSY` worker choice strategy.
238
239### Changed
240
241- Optimize worker storage in pool.
242- Optimize worker alive status check.
243- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
244- Optimize `LESS_USED` worker choice strategy.
245
246### Fixed
247
248- Ensure trimmable characters are checked at pool initialization.
249- Fix message id integer overflow.
250- Fix pool worker removal in worker choice strategy internals.
251- Fix package publication with pnpm.
252
8fe15920
JB
253## [2.4.0-1] - 2023-04-03
254
5b301c28
JB
255### Added
256
257- Add `LESS_BUSY` worker choice strategy.
258
259### Changed
260
261- Optimize worker storage in pool.
262- Optimize worker alive status check.
263- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
264- Optimize `LESS_USED` worker choice strategy.
265
266### Fixed
267
268- Ensure trimmable characters are checked at pool initialization.
269- Fix message id integer overflow.
270- Fix pool worker removal in worker choice strategy internals.
271
2fb9ca9c
JB
272## [2.4.0-0] - 2023-04-03
273
168c526f
JB
274### Added
275
276- Add `LESS_BUSY` worker choice strategy.
277
1d71a908
JB
278### Changed
279
ffcbbad8 280- Optimize worker storage in pool.
1d71a908 281- Optimize worker alive status check.
65a60b3b 282- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
737c6d97 283- Optimize `LESS_USED` worker choice strategy.
1d71a908 284
ffcbbad8
JB
285### Fixed
286
287- Ensure trimmable characters are checked at pool initialization.
b4e75778 288- Fix message id integer overflow.
97a2abc3 289- Fix pool worker removal in worker choice strategy internals.
ffcbbad8 290
08372738
JB
291## [2.3.10] - 2023-03-18
292
710826bc
JB
293### Fixed
294
295- Fix `exports` syntax for ESM and CommonJS.
296
297### Changed
298
299- Permit SemVer pre-release publication.
76e5ac6f 300
e4796ecd
JB
301## [2.3.10-2] - 2023-03-18
302
6abad580
JB
303### Fixed
304
305- Fix `exports` syntax for ESM and CommonJS.
306
a2ee98cc
JB
307## [2.3.10-1] - 2023-03-18
308
7e060cee
JB
309### Changed
310
90483887 311- Permit SemVer pre-release publication.
7e060cee 312
c81bfafb
JB
313## [2.3.10-0] - 2023-03-18
314
fe18768d
JB
315### Fixed
316
317- Fix `exports` syntax for ESM and CommonJS.
318
d7b78217
JB
319## [2.3.9] - 2023-03-18
320
ed6dd37f
JB
321### Changed
322
323- Introduce ESM module support along with CommonJS one.
324
325### Fixed
326
327- Fix brown paper bag bug referencing the same object literal.
328
68e2ad86
JB
329## [2.3.8] - 2023-03-18
330
ca6c7d70
JB
331### Changed
332
333- Switch internal benchmarking code to benny.
fbdedeb9
JB
334- Switch to TypeScript 5.x.x.
335- Switch rollup bundler plugins to core ones.
ed6dd37f 336- Switch to TSDoc syntax.
fbdedeb9 337- Enforce conventional commits.
ca6c7d70 338
d15211d4
JB
339### Fixed
340
341- Fix random integer generator.
fbdedeb9 342- Fix worker choice strategy pool type identification at initialization.
d15211d4 343
995705ea
JB
344## [2.3.7] - 2022-10-23
345
b953022b
JB
346### Changed
347
348- Switch to open collective FOSS project funding platform.
78cea37e
JB
349- Switch to ts-standard linter configuration on TypeScript code.
350
351### Fixed
352
353- Fixed missing async on pool execute method.
354- Fixed typing in TypeScript example.
355- Fixed types in unit tests.
b953022b 356
3b9f6953
JB
357## [2.3.6] - 2022-10-22
358
f80cead4
JB
359### Changed
360
361- Cleanup pool attributes and methods.
362- Refine error types thrown.
363
364### Fixed
365
366- Fix continuous integration build on windows.
367- Fix code coverage reporting by using c8 instead of nyc.
368
efc22107
JB
369## [2.3.5] - 2022-10-21
370
7a6a0a96
JB
371### Changed
372
a05c10de
JB
373- Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
374- Optimize tasks usage lookup implementation.
7a6a0a96 375
b4904890
JB
376### Fixed
377
378- Fix missed pool event emitter type export.
379- Fix typedoc documentation generation.
380
a875f8d1
JB
381## [2.3.4] - 2022-10-17
382
73cda448
JB
383### Added
384
385- Fully automate release process with release-it.
386
45a5a54c
JB
387### Changed
388
73cda448 389- Optimize fair share task scheduling algorithm implementation.
eb4a8a82 390- Update benchmarks versus external pools results with latest version.
45a5a54c 391
90ee1b18 392## [2.3.3] - 2022-10-15
1a76932b
JB
393
394### Added
395
396- Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
397
90ee1b18 398## [2.3.2] - 2022-10-14
11df3590
JB
399
400### Changed
401
402- Optimize fair share worker selection strategy implementation.
403
404### Fixed
405
406- Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
407
90ee1b18 408## [2.3.1] - 2022-10-13
23ff945a
JB
409
410### Added
411
412- Pool worker choice strategies:
413 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
414 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
415
90ee1b18 416## [2.2.2] - 2022-10-09
cb2b6c69
JB
417
418### Fixed
419
420- Fixed `README.md` file.
421
90ee1b18 422## [2.2.1] - 2022-10-08
bdacc2d2 423
bdaf31cd
JB
424### Added
425
426- Dynamic worker choice strategy change at runtime.
bdacc2d2 427
90ee1b18 428## [2.2.0] - 2022-01-05
7e0d447f
JB
429
430### Breaking Changes
431
432- Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
433
90ee1b18 434## [2.1.0] - 2021-08-29
35cf1c03
JB
435
436### Added
437
438- Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
e088a00c
JB
439
440### Breaking Changes
441
442- `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
443- `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
444- `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
c365b2d3 445- `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
e088a00c 446
90ee1b18 447## [2.0.2] - 2021-05-12
14916bf9
JB
448
449### Bug fixes
450
451- Fix `busy` event emission on fixed pool type
452
90ee1b18 453## [2.0.1] - 2021-03-16
7f685093
JB
454
455### Bug fixes
456
457- Check if pool options are properly set.
458- `busy` event is emitted on all pool types.
459
90ee1b18 460## [2.0.0] - 2021-03-01
fa0f5b28 461
f3f833ab 462### Bug fixes
d63d3be3 463
ddbeaffd 464- Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
d63d3be3 465
fa0f5b28
S
466### Breaking Changes
467
7f685093 468- `FullPool` event is now renamed to `busy`.
1927ee67 469- `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
1a81f8af 470 _Find more details on our JSDoc._
ddbeaffd 471
1927ee67
APA
472- `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
473
ddbeaffd 474- We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
fa0f5b28 475
ec2ccfc8
JB
476### Pool options types declaration merge
477
478`FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
479
fa0f5b28
S
480#### New `export` strategy
481
482```js
483// Before
777b7824 484const DynamicThreadPool = require('poolifier/lib/dynamic')
fa0f5b28 485// After
777b7824 486const { DynamicThreadPool } = require('poolifier/lib/dynamic')
fa0f5b28
S
487```
488
489But you should always prefer just using
490
491```js
777b7824 492const { DynamicThreadPool } = require('poolifier')
fa0f5b28
S
493```
494
d3c8a1a8
S
495#### New type definitions for input data and response
496
ec2ccfc8 497For cluster worker and worker-thread pools, you can now only send and receive serializable data.
d3c8a1a8
S
498_This is not a limitation by poolifier but NodeJS._
499
3a4b605f 500#### Public property replacements
5c5a1fb7 501
3a4b605f 502`numWorkers` property is now `numberOfWorkers`
5c5a1fb7 503
280c2a77 504#### Internal (protected) properties and methods renaming
fa0f5b28 505
280c2a77
S
506These properties are not intended for end users
507
508- `id` => `nextMessageId`
509
510These methods are not intended for end users
fa0f5b28
S
511
512- `_chooseWorker` => `chooseWorker`
280c2a77 513- `_newWorker` => `createWorker`
fa0f5b28
S
514- `_execute` => `internalExecute`
515- `_chooseWorker` => `chooseWorker`
516- `_checkAlive` => `checkAlive`
517- `_run` => `run`
518- `_runAsync` => `runAsync`
519
90ee1b18 520## [1.1.0] - 2020-05-21
0312f71a
APA
521
522### Added
523
524- ThreadWorker support async functions as option
cf9aa6c3 525- Various external library patches
0312f71a 526
90ee1b18 527## [1.0.0] - 2020-01-24
522eea03 528
529### Added
530
531- FixedThreadPool implementation
532- DynamicThreadPool implementation
0312f71a 533- WorkerThread implementation to improve developer experience