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