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