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