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