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