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