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