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