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