docs: add changelog entry
[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 8## [Unreleased]
9aa78bcb 9
fcc6278e
JB
10### Fixed
11
12- Fix publishing on JSR.
13
7586f5a8
JB
14## [3.1.23] - 2024-03-27
15
b7bb8586
JB
16### Changed
17
18- Publish on JSR.
19
01f4a5ce
JB
20## [3.1.22] - 2024-03-15
21
d67bed32
JB
22### Fixed
23
24- Fix pool event emitter registered callbacks removal at `destroy()`.
25
6fd820e6
JB
26## [3.1.21] - 2024-02-22
27
369179f6
JB
28### Fixed
29
30- Fix null exception regression: [#1496](https://github.com/poolifier/poolifier/issues/1496).
31
c96e6364
JB
32## [3.1.20] - 2024-02-11
33
d20cde84
JB
34### Fixed
35
36- Ensure `worker_threads` workers are unreferenced at termination.
37
a7358578
JB
38## [3.1.19] - 2024-01-16
39
16d7e943
JB
40### Fixed
41
42- Fix possible null exception at task finishing handling.
43
57bf289f
JB
44### Changed
45
46- Optimize Deque implementation to improve tasks queueing performance.
47
7cf320c9
JB
48## [3.1.18] - 2024-01-06
49
6d7beb8c
JB
50### Fixed
51
52- Fix dynamic pool with minimum number of workers set to zero: [#1748](https://github.com/poolifier/poolifier/issues/1748).
53
a4bc8d0e
JB
54## [3.1.17] - 2024-01-05
55
2b6b412f
JB
56### Changed
57
58- Improve performance by clean up unneeded condition checks on hot code paths.
59
0d64fd53
JB
60## [3.1.16] - 2024-01-03
61
4302d959
JB
62### Fixed
63
64- Add missing type to TS type definitions.
65
9122cc2c
JB
66## [3.1.15] - 2024-01-02
67
a4d25410
JB
68### Fixed
69
70- Fix CommonJS support with TypeScript: [#1821](https://github.com/poolifier/poolifier/issues/1821).
71
565b7e65
JB
72## [3.1.15-0] - 2024-01-02
73
63406ebd
JB
74### Fixed
75
a4d25410 76- Fix CommonJS support with TypeScript: [#1821](https://github.com/poolifier/poolifier/issues/1821).
63406ebd 77
56412ef4
JB
78## [3.1.14] - 2024-01-01
79
e44639e9
JB
80### Fixed
81
82- Properly handle dynamic pool with zero minimum size.
83
5e133e82
JB
84## [3.1.13] - 2023-12-30
85
b20bf19a
JB
86### Changed
87
88- Reduce branching in several hot code paths.
89- Use faster object cloning implementation.
90
60aa9f2f
JB
91## [3.1.12] - 2023-12-27
92
28883f84
JB
93### Fixed
94
95- Fix tasks redistribution triggers at pool destroying.
96
97### Changed
98
99- Switch TypeScript module resolution to Node16.
100
164c80dd
JB
101## [3.1.12-0] - 2023-12-27
102
f4ef37a8
JB
103### Fixed
104
105- Fix tasks redistribution triggers at pool destroying.
106
0766991a
JB
107## [3.1.11] - 2023-12-24
108
5eb72b9e
JB
109### Fixed
110
111- Avoid worker node cross tasks stealing.
112- Ensure only half the pool worker nodes can steal tasks.
113
4618ccfd
JB
114## [3.1.10] - 2023-12-23
115
09616edb
JB
116### Changed
117
118- Avoid useless branching on pool type.
119
bba20209
JB
120## [3.1.9] - 2023-12-22
121
2889bd70
JB
122### Changed
123
124- Readd ThreadPoolOptions and ClusterPoolOptions TS type aliases to PoolOptions.
125
b1bbc365
JB
126## [3.1.8] - 2023-12-21
127
ad3836ed
JB
128### Fixed
129
130- Fix default worker weight computation.
131- Fix possible null exception at pool destroying.
132
72523ab9
JB
133## [3.1.7] - 2023-12-20
134
55d7d600
JB
135### Fixed
136
137- Ensure worker choice strategies implementation wait for worker node readiness: [#1748](https://github.com/poolifier/poolifier/issues/1748).
138
165f3d56
JB
139## [3.1.6] - 2023-12-18
140
85b2561d
JB
141### Fixed
142
143- Fix pool destroying with tasks queuing enabled.
144
6c8cec9e
JB
145## [3.1.5] - 2023-12-18
146
32b141fd
JB
147### Added
148
149- Add queued tasks end timeout support to worker node termination.
150
f11ec29c
JB
151## [3.1.4] - 2023-12-18
152
4e0afe97
JB
153### Fixed
154
155- Make more robust the fix for possible null exception at handling task execution response.
156
f592ef16
JB
157## [3.1.3] - 2023-12-17
158
9b358e72
JB
159### Fixed
160
161- Fix possible null exception at handling task execution response.
162
c61772e5
JB
163## [3.1.2] - 2023-12-17
164
87347ea8
JB
165### Fixed
166
32b141fd 167- Wait for queued tasks to end at worker node termination.
87347ea8 168
6e664bec
JB
169## [3.1.1] - 2023-12-16
170
51280f9b
JB
171### Fixed
172
173- Fix pool options TS type definition.
174
5362c66b
JB
175## [3.1.0] - 2023-12-16
176
c3719753
JB
177### Changed
178
179- TypeScript breaking change: merge ThreadPoolOptions and ClusterPoolOptions types into PoolOptions type.
180
42321a2b
JB
181## [3.0.14] - 2023-12-13
182
fa548cda
JB
183### Fixed
184
185- Fix possible null exception with worker_threads pools.
186
d727d871
JB
187## [3.0.13] - 2023-12-12
188
fb5a7307
JB
189### Fixed
190
191- Ensure worker choice strategy wait for worker nodes readiness.
192
193### Changed
194
195- Remove infinite retries support in worker choice strategy to avoid configuration leading to possible infinite recursion or loop.
196
90a43710
JB
197## [3.0.12] - 2023-12-12
198
9aa78bcb
JB
199### Changed
200
201- Add infinite retries support in worker choice strategy.
45a5a54c 202
d8163b08
JB
203## [3.0.11] - 2023-12-11
204
f18fd12b
JB
205### Fixed
206
457dd3dc 207- Ensure pool asynchronous resource properly track tasks execution.
f18fd12b 208
bd453998
JB
209## [3.0.10] - 2023-12-08
210
cb71d660
JB
211### Changed
212
457dd3dc 213- Add a fastpath when tasks stealing or redistribution is impossible.
cb71d660 214
d7164344
JB
215## [3.0.9] - 2023-11-26
216
78f60f82
JB
217### Fixed
218
219- Remove all pool events listener at pool destroying.
220- Remove all worker node events listener at worker node destroying.
9f99eb9b 221- Fix worker node event emitter listeners handling memory leak at pool options runtime change.
78f60f82 222
0c08a681
JB
223## [3.0.8] - 2023-11-25
224
463226a4
JB
225### Fixed
226
457dd3dc 227- Ensure continuous tasks stealing on idle start at worker node idling.
463226a4 228
14dad1fd
JB
229## [3.0.7] - 2023-11-24
230
65542a35
JB
231### Changed
232
233- Make continuous tasks stealing start at worker node idling.
234
82c5db63
JB
235## [3.0.6] - 2023-11-24
236
711623b8
JB
237### Fixed
238
b51d8596 239- Ensure pool statuses are checked at initialization, `start()` or `destroy()`.
55082af9 240- Ensure pool `ready` event can be emitted after several `start()/destroy()` cycles.
711623b8 241
5aa31a74
JB
242## [3.0.5] - 2023-10-27
243
d91689fd
JB
244### Fixed
245
55082af9 246- Ensure pool `ready` event can be emitted only once.
d91689fd 247
597775b2
JB
248## [3.0.4] - 2023-10-20
249
03fb313b
JB
250### Changed
251
49d60f11 252- Switch to Bencher for benchmarking: [https://bencher.dev/perf/poolifier](https://bencher.dev/perf/poolifier).
03fb313b
JB
253- Use builtin retry mechanism in worker choice strategies instead of custom one.
254
6c285176
JB
255## [3.0.3] - 2023-10-19
256
9761e404
JB
257### Fixed
258
259- Avoid null exception at sending message to worker.
535fd8d5 260- Avoid null exception at checking worker node readiness.
9761e404 261
358dc40f
JB
262## [3.0.2] - 2023-10-17
263
97256a85
JB
264### Fixed
265
c3c2b35e 266- Fix race condition at dynamic worker node task assignment and scheduled removal. See issue [#1468](https://github.com/poolifier/poolifier/issues/1468) and [#1496](https://github.com/poolifier/poolifier/issues/1496).
97256a85 267
7a570743
JB
268## [3.0.1] - 2023-10-16
269
dbfa7948
JB
270### Fixed
271
fc84edac 272- Workaround possible race condition at work nodes array element removal and querying. See issue [#1468](https://github.com/poolifier/poolifier/issues/1468).
dbfa7948 273
365f13e4
JB
274### Changed
275
c3c2b35e 276- Switch the worker node eventing code to `EventTarget` API.
365f13e4 277
003b3275
JB
278## [3.0.0] - 2023-10-08
279
277c49bf
JB
280### Changed
281
282- Remove Node.js 16.x.x (EOL) support.
283
3c9e911a
JB
284## [2.7.5] - 2023-10-03
285
f80125ca
JB
286### Changed
287
288- Use `EventEmitterAsyncResource` type from `@types/node` for pool event emitter. TypeScript users will need to update to latest `@types/node` version.
289
3466e757
JB
290## [2.7.4] - 2023-09-25
291
67b26ae2
JB
292### Fixed
293
294- Fix source maps (bundler issue).
295
eeb1f961
JB
296## [2.7.3] - 2023-09-24
297
b5604034
JB
298### Changed
299
300- Convert pool event emitter to event emitter async resource.
301
f2df6dc8
JB
302## [2.7.2] - 2023-09-23
303
116ca64b
JB
304### Changed
305
306- Add source maps to npm package to ease debugging.
307
1e319a70
JB
308### Added
309
310- Continuous benchmarking versus other worker pools: [https://poolifier.github.io/benchmark](https://poolifier.github.io/benchmark).
311
aab2819b
JB
312## [2.7.1] - 2023-09-20
313
ae036c3e
JB
314### Fixed
315
316- Ensure worker message listener used one time are removed after usage.
317
15d7c489
JB
318## [2.7.0] - 2023-09-19
319
160557ff
JB
320### Fixed
321
322- Fix task stealing related tasks queue options handling at runtime.
323
c3284191
JB
324### Changed
325
326- Rename `listTaskFunctions()` to `listTaskFunctionNames()` in pool and worker API.
327
328### Added
329
35808931 330- Add `hasTaskFunction()`, `addTaskFunction()`, `removeTaskFunction()`, `setDefaultTaskFunction()` methods to pool API: [PR #1148](https://github.com/poolifier/poolifier/pull/1148).
c20084b6 331- Stricter worker constructor arguments validation.
c3284191 332
04054352
JB
333## [2.6.45] - 2023-09-17
334
093af25b
JB
335### Changed
336
337- Disable publication on GitHub packages registry on release until authentication issue is fixed.
09d9af02
JB
338
339### Added
340
ce0ab2d7 341- Add `startWorkers` to pool options to whether start the minimum number of workers at pool initialization or not.
cde5b54e 342- Add `start()` method to pool API to start the minimum number of workers.
af98b972 343- Add `taskStealing` and `tasksStealingOnPressure` to tasks queue options to whether enable task stealing or not and whether enable tasks stealing under back pressure or not.
1e319a70 344- Continuous internal benchmarking: [https://poolifier.github.io/benchmark-results/dev/bench](https://poolifier.github.io/benchmark-results/dev/bench).
f1c674cd 345
bce9ffdf
JB
346## [2.6.44] - 2023-09-08
347
4cb259d3
JB
348### Fixed
349
350- Use a dedicated PAT to publish on GitHub packages registry.
351
352### Added
353
354- Publish on GitHub packages registry on release.
355
356### Changed
357
358- Switch from rome to biome: [PR #1128](https://github.com/poolifier/poolifier/pull/1128).
359
fbda1e26
JB
360## [2.6.43] - 2023-09-08
361
15fc82ba
JB
362### Added
363
4cb259d3 364- Publish on GitHub packages registry on release.
15fc82ba
JB
365
366### Changed
367
4cb259d3 368- Switch from rome to biome: [PR #1128](https://github.com/poolifier/poolifier/pull/1128).
15fc82ba 369
b47306a3
JB
370## [2.6.42] - 2023-09-06
371
ad11ca81
JB
372### Changed
373
374- Optimize hot code paths implementation: avoid unnecessary branching, add and use optimized helpers (min, max), use reduce() array helper, ...
375
1b37751d
JB
376## [2.6.41] - 2023-09-03
377
f3a91bac
JB
378### Changed
379
380- Optimize worker choice strategies implementation.
381
7790a494
JB
382## [2.6.40] - 2023-09-01
383
6fe200b4
JB
384### Fixed
385
386- Do not pre-choose in WRR worker choice strategy to avoid bias.
68738842 387- Avoid array out of bound in worker choice strategies after worker node removal.
6fe200b4 388
766c7f84
JB
389## [2.6.39] - 2023-08-30
390
edf8ce4e
JB
391### Fixed
392
4cb259d3 393- Fix race condition in worker choice strategies at worker node info querying while not yet initialized.
edf8ce4e 394
904a5689
JB
395## [2.6.38] - 2023-08-30
396
b40c4b06
JB
397### Added
398
399- Bundle typescript types declaration into one file.
400
619f403b
JB
401### Changed
402
403- Improve interleaved weighted round robin worker choice strategy implementation.
404
5a24d71c
JB
405## [2.6.37] - 2023-08-28
406
bdb9d712
JB
407### Fixed
408
409- Ensure unused worker usage statistics are deleted at runtime.
410
8c0b113f
JB
411### Changed
412
413- Rename worker choice strategy options `choiceRetries` to `retries`.
574c5c8d 414- Avoid unnecessary branching in worker choice strategies.
8c0b113f 415
ba821940
JB
416## [2.6.36] - 2023-08-27
417
9d2d0da1
JB
418### Fixed
419
420- Fix pool `execute()` arguments check.
421
1f0766e7
JB
422### Changed
423
424- Make continuous tasks stealing algorithm less aggressive.
8780236f 425- Fine tune tasks stealing algorithm under back pressure.
1f0766e7 426
ffd2c1ff
JB
427## [2.6.35] - 2023-08-25
428
dc021bcc
JB
429### Fixed
430
431- Don't account worker usage statistics for tasks that have failed.
3baa0837 432- Fix pool information runtime and wait time median computation.
dc021bcc
JB
433
434### Changed
435
436- Update simple moving average implementation to use a circular buffer.
437- Update simple moving median implementation to use a circular buffer.
68cbdc84
JB
438- Account for stolen tasks in worker usage statistics and pool information.
439
440### Added
441
442- Continuous tasks stealing algorithm.
dc021bcc 443
c58bc2a1
JB
444## [2.6.34] - 2023-08-24
445
0bc68267
JB
446### Fixes
447
448- Avoid cascading tasks stealing under back pressure.
449
450### Changed
451
452- Add fastpath to queued tasks rescheduling.
453
39fb7ad0
JB
454## [2.6.33] - 2023-08-24
455
dd951876
JB
456### Fixed
457
458- Fix queued tasks rescheduling.
459
ff3f866a
JB
460### Changed
461
462- Rename tasks queue options `queueMaxSize` to `size`.
463
a6b3272b 464### Added
dd951876 465
a6b3272b 466- Task stealing scheduling algorithm if tasks queueing is enabled.
dd951876 467
c55c9b5d
JB
468## [2.6.32] - 2023-08-23
469
15b176e0
JB
470### Fixed
471
472- Ensure no task can be executed when the pool is destroyed.
473
20c6f652
JB
474### Added
475
476- Add `queueMaxSize` option to tasks queue options.
574b351d 477- Add O(1) deque implementation implemented with doubly linked list and use it for tasks queueing.
72695f86 478- Add tasks stealing algorithm when a worker node queue is back pressured if tasks queueing is enabled.
20c6f652 479
e560a9f2
JB
480## [2.6.31] - 2023-08-20
481
b1aae695
JB
482### Fixed
483
3e8611a8 484- Fix worker choice strategy retries mechanism in some edge cases.
b1aae695 485
94407def
JB
486### Changed
487
e695d66f 488- Make orthogonal worker choice strategies tasks distribution and created dynamic worker usage.
a71b05bc 489- Remove the experimental status of the `LEAST_ELU` worker choice strategy.
94407def 490
962b9863
JB
491## [2.6.30] - 2023-08-19
492
33e6bb4c
JB
493### Fixed
494
495- Ensure pool event `backPressure` is emitted.
496- Ensure pool event `full` is emitted only once.
8735b4e5 497- Ensure worker node cannot be instantiated without proper arguments.
33e6bb4c 498
8cc4ea81
JB
499## [2.6.29] - 2023-08-18
500
6169563b
JB
501### Fixed
502
55082af9 503- Fix race condition between readiness and task functions worker message handling at startup.
5dd4043c 504- Fix duplicate task function worker usage statistics computation per task function.
db0e38ee 505- Update task function worker usage statistics if and only if there's at least two different task functions.
5bb5be17 506- Fix race condition at task function worker usage executing task computation leading to negative value.
6169563b 507
8990357d
JB
508### Added
509
445264e8 510- Add back pressure detection on the worker node queue. Event `backPressure` is emitted when all worker node queues are full (worker node queue size >= poolMaxSize^2).
8990357d
JB
511- Use back pressure detection in worker choice strategies.
512- Add worker choice strategies retries mechanism if no worker is eligible.
513
21157987
JB
514## [2.6.28] - 2023-08-16
515
f05ed93c
JB
516### Fixed
517
518- Ensure pool workers are properly initialized.
519
12d67776
JB
520### Added
521
522- HTTP server pool examples: express-cluster, express-hybrid.
523
d18fccb1
JB
524### Changed
525
526- Remove now useless branching in worker hot code path.
527
741cdb34
JB
528## [2.6.27] - 2023-08-15
529
50e7f498
JB
530### Fixed
531
532- Add `KillHandler` type definition to exported types.
533
ef3891a3
JB
534### Added
535
536- Add `destroy` event to pool API.
537
e9dc6efa
JB
538## [2.6.26] - 2023-08-15
539
2b099bf7
JB
540### Added
541
542- Add kill handler to worker options allowing to execute custom code when worker is killed.
ef3891a3 543- Add `listTaskFunctions()` method to pool API.
1f4553c6 544- SMTP client pool example: nodemailer.
2b099bf7 545
5b726f72
JB
546## [2.6.25] - 2023-08-13
547
72855e92
JB
548### Added
549
3b311539 550- HTTP server pool examples: fastify-cluster, fastify-hybrid.
02999424 551- WebSocket server pool examples: ws-cluster, ws-hybrid.
72855e92 552
7aadd6e5
JB
553## [2.6.24] - 2023-08-12
554
7d91a8cd
JB
555### Added
556
557- Add array of transferable objects to the `execute()` method arguments.
02999424 558- WebSocket server pool examples: ws-worker_threads.
7d91a8cd 559
6b4263b4
JB
560## [2.6.23] - 2023-08-11
561
3d76750a 562### Fixed
8e0af894 563
3d76750a 564- Fix pool busyness semantic when tasks queueing is enabled: the pool is busy when the number of executing tasks on each worker has reached the maximum tasks concurrency per worker.
9606b474 565
3d76750a
JB
566### Added
567
568- HTTP client pool examples: fetch, node-fetch and axios with multiple task functions.
02999424 569- HTTP server pool examples: express-worker_threads, fastify-worker_threads.
3d76750a
JB
570
571## [2.6.22] - 2023-08-10
9606b474 572
3d76750a 573### Fixed
9606b474
JB
574
575- Add missing `types` field to package.json `exports`.
576
3d76750a
JB
577### Changed
578
579- Structure markdown documentation (PR #811).
580
d9647bdd
JB
581## [2.6.21] - 2023-08-03
582
2111ec12
JB
583### Changed
584
585- Improve code documentation.
586- Code refactoring and cleanup for better maintainability and readability.
587
5c30b9d9
JB
588## [2.6.20] - 2023-07-21
589
10ecf8fd
JB
590### Fixed
591
592- Fix queued tasks redistribution on error task execution starvation.
a1763c54 593- Ensure tasks queueing per worker condition is untangled from the pool busyness semantic.
10ecf8fd 594
aa9eede8
JB
595### Changed
596
7c89e6a4 597- Drastically reduce lookups by worker in the worker nodes.
aa9eede8 598
62485908
JB
599## [2.6.19] - 2023-07-20
600
2e2ef9c3
JB
601### Added
602
603- Dedicated internal communication channel for worker_threads pools.
604
8f4c9491
JB
605## [2.6.18] - 2023-07-19
606
8660b972
JB
607### Changed
608
609- Code refactoring and cleanup for better maintainability and readability. Bundle size is a bit smaller.
610
206a3519
JB
611## [2.6.17] - 2023-07-16
612
b4899fae
JB
613### Added
614
1a3e01ba 615- Add `listTaskFunctions()` method to worker API.
b4899fae 616
58a06a6c
JB
617## [2.6.16] - 2023-07-12
618
2a69b8c5
JB
619### Fixed
620
80520ca4 621- Fix pool startup detection.
2a69b8c5
JB
622- Fix worker task functions handling.
623
b5900b02
JB
624## [2.6.15] - 2023-07-11
625
19dbc45b
JB
626### Added
627
628- Take into account worker node readiness in worker choice strategies.
629
4a0db581
JB
630## [2.6.14] - 2023-07-10
631
87e44747
JB
632### Fixed
633
634- Fix task function statistics tracking.
635
0265272f
JB
636## [2.6.13] - 2023-07-10
637
968a2e8c
JB
638### Added
639
640- Add per task function statistics tracking.
782299f8 641- Add public methods to manipulate the worker task functions at runtime.
968a2e8c 642
44c8c00f
JB
643## [2.6.12] - 2023-07-09
644
aa4bf4b2
JB
645### Fixed
646
647- Workaround import issue with `node:os` module in node 16.x.x.
648
b7cfced1
JB
649## [2.6.11] - 2023-07-09
650
d5024c00
JB
651### Fixed
652
653- Fix pool readiness semantic.
654
f313a208
JB
655## [2.6.10] - 2023-07-08
656
2431bdb4
JB
657### Fixed
658
659- Ensure workers are not recreated on error at pool startup.
660
661### Added
662
663- Add `ready` and `strategy` fields to pool information.
664- Add pool event `ready` to notify when the number of workers created in the pool has reached the maximum size expected and are ready.
caadbd41 665- Add dynamic pool sizing checks.
2431bdb4 666
369d0a51
JB
667## [2.6.9] - 2023-07-07
668
2845f2a5
JB
669### Fixed
670
671- Recreate the right worker type on uncaught exception.
672
673### Added
674
675- Add minimum and maximum to internal measurement statistics.
1dcf8b7b 676- Add `runTime` and `waitTime` to pool information.
75d3401a 677- Check worker inactive time only on dynamic worker.
2845f2a5 678
fc97d613
JB
679## [2.6.8] - 2023-07-03
680
92b1feaa
JB
681### Fixed
682
683- Brown paper bag release to fix version handling in pool information.
684
52d54060
JB
685## [2.6.7] - 2023-07-03
686
5bc91f3e
JB
687### Fixed
688
689- Ensure worker queued tasks at error are reassigned to other pool workers.
690
afe0d5bf
JB
691### Added
692
693- Add pool `utilization` ratio to pool information.
23ccf9d7 694- Add `version` to pool information.
e5b3047d 695- Add worker information to worker nodes.
afe0d5bf 696
f42c583f
JB
697## [2.6.6] - 2023-07-01
698
6961ca9a
JB
699### Added
700
d5e3c4ff 701- Add safe helper `availableParallelism()` to help sizing the pool.
6961ca9a 702
3749facb
JB
703### Fixed
704
705- Ensure message handler is only registered in worker.
706
6fed2513
JB
707## [2.6.5] - 2023-06-27
708
c72f6987
JB
709### Known issues
710
70726c28 711- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
c72f6987
JB
712
713### Fixed
714
715- Artificial version bump to 2.6.5 to workaround publication issue.
d5e3c4ff 716- Ensure cluster pool `destroy()` gracefully shutdowns worker's server.
c72f6987
JB
717- Ensure pool event is emitted before task error promise rejection.
718- Fix queued tasks count computation.
719
720### Removed
721
2fbe1783 722- Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
c72f6987 723
6426631b
JB
724## [2.6.4] - 2023-06-27
725
941f9a7c
JB
726### Known issues
727
70726c28 728- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
941f9a7c 729
2c039e43
JB
730### Fixed
731
d5e3c4ff 732- Ensure cluster pool `destroy()` gracefully shutdowns worker's server.
2c039e43 733- Ensure pool event is emitted before task error promise rejection.
9c16fb4b 734- Fix queued tasks count computation.
2c039e43 735
941f9a7c
JB
736### Removed
737
2fbe1783 738- Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
941f9a7c 739
bc1b0765
JB
740## [2.6.3] - 2023-06-19
741
a6a2dc4c
JB
742### Fixed
743
744- Ensure no tasks are queued when trying to soft kill a dynamic worker.
f0d7f803 745- Update strategies internals after statistics computation.
a6a2dc4c 746
7b56f532
JB
747### Changed
748
749- Optimize O(1) queue implementation.
750
b628596c
JB
751## [2.6.2] - 2023-06-12
752
a9e89d00
JB
753### Fixed
754
755- Fix new worker use after creation in dynamic pool given the current worker choice strategy.
756
4368a898
JB
757## [2.6.1] - 2023-06-10
758
931d43e2
JB
759### Added
760
13ab5b87 761- Add worker choice strategy documentation: [README.md](./docs/worker-choice-strategies.md).
931d43e2 762
f1c06930
JB
763### Fixed
764
765- Fix average statistics computation: ensure failed tasks are not accounted.
766
16671b07
JB
767## [2.6.0] - 2023-06-09
768
a1347286
JB
769### Added
770
5af9c0f7 771- Add `LEAST_ELU` worker choice strategy (experimental).
9adcefab 772- Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
a1347286 773
1c6fe997
JB
774### Changed
775
776- Refactor pool worker node usage internals.
477f48e7 777- Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
f63a9dda 778- Breaking change: pool information `info` property object fields have been renamed.
1c6fe997
JB
779
780### Fixed
781
782- Fix wait time accounting.
783- Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
784- Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
785
aa07d6ee
JB
786## [2.5.4] - 2023-06-07
787
b6b32453
JB
788### Added
789
790- Add Event Loop Utilization (ELU) statistics to worker tasks usage.
791
792### Changed
793
794- Compute statistics at the worker level only if needed.
2fbe1783 795- Add `worker_threads` options to thread pool options.
b6b32453 796
272d4d8f
JB
797### Fixed
798
799- Make the `LEAST_BUSY` strategy only relies on task runtime.
800
ed47fb3d
JB
801## [2.5.3] - 2023-06-04
802
89a4abfd
JB
803### Changed
804
805- Refine pool information content.
b4213b7f 806- Limit pool internals public exposure.
89a4abfd 807
8a9febf5
JB
808## [2.5.2] - 2023-06-02
809
91ee39ed
JB
810### Added
811
812- Add `taskError` pool event for task execution error.
6b27d407 813- Add pool information `info` property to pool.
91ee39ed
JB
814- Emit pool information on `busy` and `full` pool events.
815
8babb151
JB
816## [2.5.1] - 2023-06-01
817
0e05c4dc
JB
818### Added
819
1f68cede 820- Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
91ee39ed 821- Add `error` pool event for uncaught worker error.
0e05c4dc 822
a8766181
JB
823## [2.5.0] - 2023-05-31
824
e4543b14
JB
825### Added
826
827- Switch pool event emitter to `EventEmitterAsyncResource`.
6da80d38 828- Add tasks wait time accounting in per worker tasks usage.
5af9c0f7 829- Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
e4543b14
JB
830
831### Changed
832
833- Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
834
570efb11
JB
835## [2.4.14] - 2023-05-09
836
b0f28bad
JB
837### Fixed
838
839- Ensure no undefined task runtime can land in the tasks history.
840- Fix median computation implementation once again.
841
110b6d13
JB
842### Added
843
844- Unit tests for median and queue implementations.
845
72584880
JB
846## [2.4.13] - 2023-05-08
847
b0d6ed8f
JB
848### Fixed
849
e3058615 850- Fix worker choice strategy options validation.
b0d6ed8f
JB
851- Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
852
06140c32
JB
853## [2.4.12] - 2023-05-06
854
a86b6df1
JB
855### Added
856
857- Support multiple task functions per worker.
08f3f44c 858- Add custom worker weights support to worker choice strategies options.
a86b6df1 859
29ee7e9a
JB
860### Changed
861
862- Use O(1) queue implementation for tasks queueing.
863
0682ba15
JB
864### Fixed
865
866- Fix median computation implementation.
867- Fix fair share worker choice strategy internals update.
868
936d53ec
JB
869## [2.4.11] - 2023-04-23
870
cb70b19d
JB
871### Changed
872
873- Optimize free worker finding in worker choice strategies.
874
15bb637a
JB
875## [2.4.10] - 2023-04-15
876
ef41a6e6
JB
877### Fixed
878
82ea6492 879- Fix typescript type definition for task function: ensure the input data is optional.
ef41a6e6
JB
880- Fix typescript type definition for pool execute(): ensure the input data is optional.
881
181eb2b4
JB
882## [2.4.9] - 2023-04-15
883
a20f0ba5
JB
884### Added
885
886- Add tasks queue enablement runtime setter to pool.
887- Add tasks queue options runtime setter to pool.
888- Add worker choice strategy options runtime setter to pool.
889
890### Changed
891
892- Remove the tasks queuing experimental status.
893
d4aeae5a
JB
894### Fixed
895
82ea6492 896- Fix task function type definition and validation.
2fc5cae3 897- Fix worker choice strategy options handling.
d4aeae5a 898
1d9e7023
JB
899## [2.4.8] - 2023-04-12
900
f9b4bbf8
JB
901### Fixed
902
903- Fix message between main worker and worker type definition for tasks.
904- Fix code documentation.
905
12ae3210
JB
906## [2.4.7] - 2023-04-11
907
7171d33f
JB
908### Added
909
910- Add worker tasks queue options to pool options.
911
e8bd29ce
JB
912### Fixed
913
914- Fix missing documentation.
915
42c7bc10
JB
916## [2.4.6] - 2023-04-10
917
681196cc
JB
918### Fixed
919
920- Ensure one task at a time is executed per worker with tasks queueing enabled.
1c6fe997 921- Properly count worker executing tasks with tasks queueing enabled.
681196cc 922
54d360e3
JB
923## [2.4.5] - 2023-04-09
924
3fafb1b2
JB
925### Added
926
9e775f96
JB
927- Use monotonic high resolution timer for worker tasks runtime.
928- Add worker tasks median runtime to statistics.
ff733df7 929- Add worker tasks queue (experimental).
3fafb1b2 930
92fa3eb6
JB
931## [2.4.4] - 2023-04-07
932
aee46736
JB
933### Added
934
935- Add `PoolEvents` enumeration and `PoolEvent` type.
936
36b5e78f
JB
937### Fixed
938
ff0c2b3e 939- Destroy worker only on alive check.
36b5e78f 940
9fb0f324
JB
941## [2.4.3] - 2023-04-07
942
28cf3617
JB
943### Fixed
944
945- Fix typedoc generation with inheritance.
946
848f0f27
JB
947## [2.4.2] - 2023-04-06
948
164d950a
JB
949### Added
950
951- Add `full` event to dynamic pool.
32417142 952- Keep worker choice strategy in memory for conditional reuse.
164d950a 953
78ab2555
JB
954### Fixed
955
956- Fix possible negative worker key at worker removal in worker choice strategies.
957
79aafe9f
JB
958## [2.4.1] - 2023-04-05
959
9cd39dd4
JB
960### Changed
961
962- Optimize worker choice strategy for dynamic pool.
963
965415bb
JB
964### Fixed
965
966- Ensure dynamic pool does not alter worker choice strategy expected behavior.
967
d8b60b1c
JB
968## [2.4.0] - 2023-04-04
969
c6bd2650
JB
970### Added
971
972- Add `LESS_BUSY` worker choice strategy.
973
974### Changed
975
976- Optimize worker storage in pool.
977- Optimize worker alive status check.
978- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
979- Optimize `LESS_USED` worker choice strategy.
2a87030e 980- Update benchmark versus external threads pools.
c6bd2650
JB
981- Optimize tasks usage statistics requirements for worker choice strategy.
982
983### Fixed
984
985- Ensure trimmable characters are checked at pool initialization.
986- Fix message id integer overflow.
987- Fix pool worker removal in worker choice strategy internals.
988- Fix package publication with pnpm.
989
d0a3f018
JB
990## [2.4.0-3] - 2023-04-04
991
b2ede285
JB
992### Added
993
994- Add `LESS_BUSY` worker choice strategy.
995
996### Changed
997
998- Optimize worker storage in pool.
999- Optimize worker alive status check.
1000- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
1001- Optimize `LESS_USED` worker choice strategy.
2a87030e 1002- Update benchmark versus external threads pools.
b2ede285
JB
1003
1004### Fixed
1005
1006- Ensure trimmable characters are checked at pool initialization.
1007- Fix message id integer overflow.
1008- Fix pool worker removal in worker choice strategy internals.
1009- Fix package publication with pnpm.
1010
a015ea40
JB
1011## [2.4.0-2] - 2023-04-03
1012
698f4bbc
JB
1013### Added
1014
1015- Add `LESS_BUSY` worker choice strategy.
1016
1017### Changed
1018
1019- Optimize worker storage in pool.
1020- Optimize worker alive status check.
1021- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
1022- Optimize `LESS_USED` worker choice strategy.
1023
1024### Fixed
1025
1026- Ensure trimmable characters are checked at pool initialization.
1027- Fix message id integer overflow.
1028- Fix pool worker removal in worker choice strategy internals.
1029- Fix package publication with pnpm.
1030
8fe15920
JB
1031## [2.4.0-1] - 2023-04-03
1032
5b301c28
JB
1033### Added
1034
1035- Add `LESS_BUSY` worker choice strategy.
1036
1037### Changed
1038
1039- Optimize worker storage in pool.
1040- Optimize worker alive status check.
1041- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
1042- Optimize `LESS_USED` worker choice strategy.
1043
1044### Fixed
1045
1046- Ensure trimmable characters are checked at pool initialization.
1047- Fix message id integer overflow.
1048- Fix pool worker removal in worker choice strategy internals.
1049
2fb9ca9c
JB
1050## [2.4.0-0] - 2023-04-03
1051
168c526f
JB
1052### Added
1053
1054- Add `LESS_BUSY` worker choice strategy.
1055
1d71a908
JB
1056### Changed
1057
ffcbbad8 1058- Optimize worker storage in pool.
1d71a908 1059- Optimize worker alive status check.
65a60b3b 1060- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
737c6d97 1061- Optimize `LESS_USED` worker choice strategy.
1d71a908 1062
ffcbbad8
JB
1063### Fixed
1064
1065- Ensure trimmable characters are checked at pool initialization.
b4e75778 1066- Fix message id integer overflow.
97a2abc3 1067- Fix pool worker removal in worker choice strategy internals.
ffcbbad8 1068
08372738
JB
1069## [2.3.10] - 2023-03-18
1070
710826bc
JB
1071### Fixed
1072
9606b474 1073- Fix package.json `exports` syntax for ESM and CommonJS.
710826bc
JB
1074
1075### Changed
1076
1077- Permit SemVer pre-release publication.
76e5ac6f 1078
e4796ecd
JB
1079## [2.3.10-2] - 2023-03-18
1080
6abad580
JB
1081### Fixed
1082
9606b474 1083- Fix package.json `exports` syntax for ESM and CommonJS.
6abad580 1084
a2ee98cc
JB
1085## [2.3.10-1] - 2023-03-18
1086
7e060cee
JB
1087### Changed
1088
90483887 1089- Permit SemVer pre-release publication.
7e060cee 1090
c81bfafb
JB
1091## [2.3.10-0] - 2023-03-18
1092
fe18768d
JB
1093### Fixed
1094
9606b474 1095- Fix package.json `exports` syntax for ESM and CommonJS.
fe18768d 1096
d7b78217
JB
1097## [2.3.9] - 2023-03-18
1098
ed6dd37f
JB
1099### Changed
1100
1101- Introduce ESM module support along with CommonJS one.
1102
1103### Fixed
1104
1105- Fix brown paper bag bug referencing the same object literal.
1106
68e2ad86
JB
1107## [2.3.8] - 2023-03-18
1108
ca6c7d70
JB
1109### Changed
1110
1111- Switch internal benchmarking code to benny.
fbdedeb9
JB
1112- Switch to TypeScript 5.x.x.
1113- Switch rollup bundler plugins to core ones.
ed6dd37f 1114- Switch to TSDoc syntax.
fbdedeb9 1115- Enforce conventional commits.
ca6c7d70 1116
d15211d4
JB
1117### Fixed
1118
1119- Fix random integer generator.
fbdedeb9 1120- Fix worker choice strategy pool type identification at initialization.
d15211d4 1121
995705ea
JB
1122## [2.3.7] - 2022-10-23
1123
b953022b
JB
1124### Changed
1125
1126- Switch to open collective FOSS project funding platform.
78cea37e
JB
1127- Switch to ts-standard linter configuration on TypeScript code.
1128
1129### Fixed
1130
1131- Fixed missing async on pool execute method.
1132- Fixed typing in TypeScript example.
1133- Fixed types in unit tests.
b953022b 1134
3b9f6953
JB
1135## [2.3.6] - 2022-10-22
1136
f80cead4
JB
1137### Changed
1138
1139- Cleanup pool attributes and methods.
1140- Refine error types thrown.
1141
1142### Fixed
1143
1144- Fix continuous integration build on windows.
1145- Fix code coverage reporting by using c8 instead of nyc.
1146
efc22107
JB
1147## [2.3.5] - 2022-10-21
1148
7a6a0a96
JB
1149### Changed
1150
a05c10de
JB
1151- Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
1152- Optimize tasks usage lookup implementation.
7a6a0a96 1153
b4904890
JB
1154### Fixed
1155
1156- Fix missed pool event emitter type export.
1157- Fix typedoc documentation generation.
1158
a875f8d1
JB
1159## [2.3.4] - 2022-10-17
1160
73cda448
JB
1161### Added
1162
1163- Fully automate release process with release-it.
1164
45a5a54c
JB
1165### Changed
1166
73cda448 1167- Optimize fair share task scheduling algorithm implementation.
2a87030e 1168- Update benchmark versus external pools results with latest version.
45a5a54c 1169
90ee1b18 1170## [2.3.3] - 2022-10-15
1a76932b
JB
1171
1172### Added
1173
1174- Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
1175
90ee1b18 1176## [2.3.2] - 2022-10-14
11df3590
JB
1177
1178### Changed
1179
1180- Optimize fair share worker selection strategy implementation.
1181
1182### Fixed
1183
1184- Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
1185
90ee1b18 1186## [2.3.1] - 2022-10-13
23ff945a
JB
1187
1188### Added
1189
1190- Pool worker choice strategies:
1191 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
1192 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
1193
90ee1b18 1194## [2.2.2] - 2022-10-09
cb2b6c69
JB
1195
1196### Fixed
1197
1198- Fixed `README.md` file.
1199
90ee1b18 1200## [2.2.1] - 2022-10-08
bdacc2d2 1201
bdaf31cd
JB
1202### Added
1203
1204- Dynamic worker choice strategy change at runtime.
bdacc2d2 1205
90ee1b18 1206## [2.2.0] - 2022-01-05
7e0d447f
JB
1207
1208### Breaking Changes
1209
9606b474 1210- Support only Node.js version 16.x.x for cluster pool: upstream cluster API have changed on that version.
7e0d447f 1211
90ee1b18 1212## [2.1.0] - 2021-08-29
35cf1c03
JB
1213
1214### Added
1215
1216- Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
e088a00c
JB
1217
1218### Breaking Changes
1219
1220- `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
1221- `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
1222- `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
c365b2d3 1223- `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
e088a00c 1224
90ee1b18 1225## [2.0.2] - 2021-05-12
14916bf9
JB
1226
1227### Bug fixes
1228
1229- Fix `busy` event emission on fixed pool type
1230
90ee1b18 1231## [2.0.1] - 2021-03-16
7f685093
JB
1232
1233### Bug fixes
1234
1235- Check if pool options are properly set.
1236- `busy` event is emitted on all pool types.
1237
90ee1b18 1238## [2.0.0] - 2021-03-01
fa0f5b28 1239
f3f833ab 1240### Bug fixes
d63d3be3 1241
ddbeaffd 1242- Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
d63d3be3 1243
fa0f5b28
S
1244### Breaking Changes
1245
7f685093 1246- `FullPool` event is now renamed to `busy`.
1927ee67 1247- `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
1a81f8af 1248 _Find more details on our JSDoc._
ddbeaffd 1249
1927ee67
APA
1250- `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
1251
ddbeaffd 1252- We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
fa0f5b28 1253
ec2ccfc8
JB
1254### Pool options types declaration merge
1255
1256`FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
1257
fa0f5b28
S
1258#### New `export` strategy
1259
1260```js
1261// Before
0eee77cb 1262const DynamicThreadPool = require('poolifier/lib/dynamic')
fa0f5b28 1263// After
0eee77cb 1264const { DynamicThreadPool } = require('poolifier/lib/dynamic')
fa0f5b28
S
1265```
1266
1267But you should always prefer just using
1268
1269```js
0eee77cb 1270const { DynamicThreadPool } = require('poolifier')
fa0f5b28
S
1271```
1272
d3c8a1a8
S
1273#### New type definitions for input data and response
1274
6677a3d3 1275For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data.
9606b474 1276_This is not a limitation by poolifier but Node.js._
d3c8a1a8 1277
3a4b605f 1278#### Public property replacements
5c5a1fb7 1279
3a4b605f 1280`numWorkers` property is now `numberOfWorkers`
5c5a1fb7 1281
280c2a77 1282#### Internal (protected) properties and methods renaming
fa0f5b28 1283
280c2a77
S
1284These properties are not intended for end users
1285
1286- `id` => `nextMessageId`
1287
1288These methods are not intended for end users
fa0f5b28
S
1289
1290- `_chooseWorker` => `chooseWorker`
280c2a77 1291- `_newWorker` => `createWorker`
fa0f5b28
S
1292- `_execute` => `internalExecute`
1293- `_chooseWorker` => `chooseWorker`
1294- `_checkAlive` => `checkAlive`
1295- `_run` => `run`
1296- `_runAsync` => `runAsync`
1297
90ee1b18 1298## [1.1.0] - 2020-05-21
0312f71a
APA
1299
1300### Added
1301
1302- ThreadWorker support async functions as option
cf9aa6c3 1303- Various external library patches
0312f71a 1304
90ee1b18 1305## [1.0.0] - 2020-01-24
522eea03 1306
1307### Added
1308
1309- FixedThreadPool implementation
1310- DynamicThreadPool implementation
0312f71a 1311- WorkerThread implementation to improve developer experience