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