Merge pull request #883 from poolifier/dependabot/npm_and_yarn/examples/typescript...
[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
JB
8## [Unreleased]
9
b1aae695
JB
10### Fixed
11
3e8611a8 12- Fix worker choice strategy retries mechanism in some edge cases.
b1aae695 13
94407def
JB
14### Changed
15
16- Make orthogonal worker choice strategies tasks distribution and dynamic worker creation usage.
a71b05bc 17- Remove the experimental status of the `LEAST_ELU` worker choice strategy.
94407def 18
962b9863
JB
19## [2.6.30] - 2023-08-19
20
33e6bb4c
JB
21### Fixed
22
23- Ensure pool event `backPressure` is emitted.
24- Ensure pool event `full` is emitted only once.
8735b4e5 25- Ensure worker node cannot be instantiated without proper arguments.
33e6bb4c 26
8cc4ea81
JB
27## [2.6.29] - 2023-08-18
28
6169563b
JB
29### Fixed
30
31- Fix race condition between ready and task functions worker message handling at startup.
5dd4043c 32- Fix duplicate task function worker usage statistics computation per task function.
db0e38ee 33- Update task function worker usage statistics if and only if there's at least two different task functions.
5bb5be17 34- Fix race condition at task function worker usage executing task computation leading to negative value.
6169563b 35
8990357d
JB
36### Added
37
445264e8 38- 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
39- Use back pressure detection in worker choice strategies.
40- Add worker choice strategies retries mechanism if no worker is eligible.
41
21157987
JB
42## [2.6.28] - 2023-08-16
43
f05ed93c
JB
44### Fixed
45
46- Ensure pool workers are properly initialized.
47
12d67776
JB
48### Added
49
50- HTTP server pool examples: express-cluster, express-hybrid.
51
d18fccb1
JB
52### Changed
53
54- Remove now useless branching in worker hot code path.
55
741cdb34
JB
56## [2.6.27] - 2023-08-15
57
50e7f498
JB
58### Fixed
59
60- Add `KillHandler` type definition to exported types.
61
ef3891a3
JB
62### Added
63
64- Add `destroy` event to pool API.
65
e9dc6efa
JB
66## [2.6.26] - 2023-08-15
67
2b099bf7
JB
68### Added
69
70- Add kill handler to worker options allowing to execute custom code when worker is killed.
ef3891a3 71- Add `listTaskFunctions()` method to pool API.
9aef1431 72- SMTP server pool example: nodemailer.
2b099bf7 73
5b726f72
JB
74## [2.6.25] - 2023-08-13
75
72855e92
JB
76### Added
77
3b311539 78- HTTP server pool examples: fastify-cluster, fastify-hybrid.
02999424 79- WebSocket server pool examples: ws-cluster, ws-hybrid.
72855e92 80
7aadd6e5
JB
81## [2.6.24] - 2023-08-12
82
7d91a8cd
JB
83### Added
84
85- Add array of transferable objects to the `execute()` method arguments.
02999424 86- WebSocket server pool examples: ws-worker_threads.
7d91a8cd 87
6b4263b4
JB
88## [2.6.23] - 2023-08-11
89
3d76750a 90### Fixed
8e0af894 91
3d76750a 92- 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 93
3d76750a
JB
94### Added
95
96- HTTP client pool examples: fetch, node-fetch and axios with multiple task functions.
02999424 97- HTTP server pool examples: express-worker_threads, fastify-worker_threads.
3d76750a
JB
98
99## [2.6.22] - 2023-08-10
9606b474 100
3d76750a 101### Fixed
9606b474
JB
102
103- Add missing `types` field to package.json `exports`.
104
3d76750a
JB
105### Changed
106
107- Structure markdown documentation (PR #811).
108
d9647bdd
JB
109## [2.6.21] - 2023-08-03
110
2111ec12
JB
111### Changed
112
113- Improve code documentation.
114- Code refactoring and cleanup for better maintainability and readability.
115
5c30b9d9
JB
116## [2.6.20] - 2023-07-21
117
10ecf8fd
JB
118### Fixed
119
120- Fix queued tasks redistribution on error task execution starvation.
a1763c54 121- Ensure tasks queueing per worker condition is untangled from the pool busyness semantic.
10ecf8fd 122
aa9eede8
JB
123### Changed
124
7c89e6a4 125- Drastically reduce lookups by worker in the worker nodes.
aa9eede8 126
62485908
JB
127## [2.6.19] - 2023-07-20
128
2e2ef9c3
JB
129### Added
130
131- Dedicated internal communication channel for worker_threads pools.
132
8f4c9491
JB
133## [2.6.18] - 2023-07-19
134
8660b972
JB
135### Changed
136
137- Code refactoring and cleanup for better maintainability and readability. Bundle size is a bit smaller.
138
206a3519
JB
139## [2.6.17] - 2023-07-16
140
b4899fae
JB
141### Added
142
1a3e01ba 143- Add `listTaskFunctions()` method to worker API.
b4899fae 144
58a06a6c
JB
145## [2.6.16] - 2023-07-12
146
2a69b8c5
JB
147### Fixed
148
80520ca4 149- Fix pool startup detection.
2a69b8c5
JB
150- Fix worker task functions handling.
151
b5900b02
JB
152## [2.6.15] - 2023-07-11
153
19dbc45b
JB
154### Added
155
156- Take into account worker node readiness in worker choice strategies.
157
4a0db581
JB
158## [2.6.14] - 2023-07-10
159
87e44747
JB
160### Fixed
161
162- Fix task function statistics tracking.
163
0265272f
JB
164## [2.6.13] - 2023-07-10
165
968a2e8c
JB
166### Added
167
168- Add per task function statistics tracking.
782299f8 169- Add public methods to manipulate the worker task functions at runtime.
968a2e8c 170
44c8c00f
JB
171## [2.6.12] - 2023-07-09
172
aa4bf4b2
JB
173### Fixed
174
175- Workaround import issue with `node:os` module in node 16.x.x.
176
b7cfced1
JB
177## [2.6.11] - 2023-07-09
178
d5024c00
JB
179### Fixed
180
181- Fix pool readiness semantic.
182
f313a208
JB
183## [2.6.10] - 2023-07-08
184
2431bdb4
JB
185### Fixed
186
187- Ensure workers are not recreated on error at pool startup.
188
189### Added
190
191- Add `ready` and `strategy` fields to pool information.
192- 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 193- Add dynamic pool sizing checks.
2431bdb4 194
369d0a51
JB
195## [2.6.9] - 2023-07-07
196
2845f2a5
JB
197### Fixed
198
199- Recreate the right worker type on uncaught exception.
200
201### Added
202
203- Add minimum and maximum to internal measurement statistics.
1dcf8b7b 204- Add `runTime` and `waitTime` to pool information.
75d3401a 205- Check worker inactive time only on dynamic worker.
2845f2a5 206
fc97d613
JB
207## [2.6.8] - 2023-07-03
208
92b1feaa
JB
209### Fixed
210
211- Brown paper bag release to fix version handling in pool information.
212
52d54060
JB
213## [2.6.7] - 2023-07-03
214
5bc91f3e
JB
215### Fixed
216
217- Ensure worker queued tasks at error are reassigned to other pool workers.
218
afe0d5bf
JB
219### Added
220
221- Add pool `utilization` ratio to pool information.
23ccf9d7 222- Add `version` to pool information.
e5b3047d 223- Add worker information to worker nodes.
afe0d5bf 224
f42c583f
JB
225## [2.6.6] - 2023-07-01
226
6961ca9a
JB
227### Added
228
d5e3c4ff 229- Add safe helper `availableParallelism()` to help sizing the pool.
6961ca9a 230
3749facb
JB
231### Fixed
232
233- Ensure message handler is only registered in worker.
234
6fed2513
JB
235## [2.6.5] - 2023-06-27
236
c72f6987
JB
237### Known issues
238
70726c28 239- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
c72f6987
JB
240
241### Fixed
242
243- Artificial version bump to 2.6.5 to workaround publication issue.
d5e3c4ff 244- Ensure cluster pool `destroy()` gracefully shutdowns worker's server.
c72f6987
JB
245- Ensure pool event is emitted before task error promise rejection.
246- Fix queued tasks count computation.
247
248### Removed
249
2fbe1783 250- Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
c72f6987 251
6426631b
JB
252## [2.6.4] - 2023-06-27
253
941f9a7c
JB
254### Known issues
255
70726c28 256- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
941f9a7c 257
2c039e43
JB
258### Fixed
259
d5e3c4ff 260- Ensure cluster pool `destroy()` gracefully shutdowns worker's server.
2c039e43 261- Ensure pool event is emitted before task error promise rejection.
9c16fb4b 262- Fix queued tasks count computation.
2c039e43 263
941f9a7c
JB
264### Removed
265
2fbe1783 266- Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
941f9a7c 267
bc1b0765
JB
268## [2.6.3] - 2023-06-19
269
a6a2dc4c
JB
270### Fixed
271
272- Ensure no tasks are queued when trying to soft kill a dynamic worker.
f0d7f803 273- Update strategies internals after statistics computation.
a6a2dc4c 274
7b56f532
JB
275### Changed
276
277- Optimize O(1) queue implementation.
278
b628596c
JB
279## [2.6.2] - 2023-06-12
280
a9e89d00
JB
281### Fixed
282
283- Fix new worker use after creation in dynamic pool given the current worker choice strategy.
284
4368a898
JB
285## [2.6.1] - 2023-06-10
286
931d43e2
JB
287### Added
288
13ab5b87 289- Add worker choice strategy documentation: [README.md](./docs/worker-choice-strategies.md).
931d43e2 290
f1c06930
JB
291### Fixed
292
293- Fix average statistics computation: ensure failed tasks are not accounted.
294
16671b07
JB
295## [2.6.0] - 2023-06-09
296
a1347286
JB
297### Added
298
5af9c0f7 299- Add `LEAST_ELU` worker choice strategy (experimental).
9adcefab 300- Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
a1347286 301
1c6fe997
JB
302### Changed
303
304- Refactor pool worker node usage internals.
477f48e7 305- Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
f63a9dda 306- Breaking change: pool information `info` property object fields have been renamed.
1c6fe997
JB
307
308### Fixed
309
310- Fix wait time accounting.
311- Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
312- Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
313
aa07d6ee
JB
314## [2.5.4] - 2023-06-07
315
b6b32453
JB
316### Added
317
318- Add Event Loop Utilization (ELU) statistics to worker tasks usage.
319
320### Changed
321
322- Compute statistics at the worker level only if needed.
2fbe1783 323- Add `worker_threads` options to thread pool options.
b6b32453 324
272d4d8f
JB
325### Fixed
326
327- Make the `LEAST_BUSY` strategy only relies on task runtime.
328
ed47fb3d
JB
329## [2.5.3] - 2023-06-04
330
89a4abfd
JB
331### Changed
332
333- Refine pool information content.
b4213b7f 334- Limit pool internals public exposure.
89a4abfd 335
8a9febf5
JB
336## [2.5.2] - 2023-06-02
337
91ee39ed
JB
338### Added
339
340- Add `taskError` pool event for task execution error.
6b27d407 341- Add pool information `info` property to pool.
91ee39ed
JB
342- Emit pool information on `busy` and `full` pool events.
343
8babb151
JB
344## [2.5.1] - 2023-06-01
345
0e05c4dc
JB
346### Added
347
1f68cede 348- Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
91ee39ed 349- Add `error` pool event for uncaught worker error.
0e05c4dc 350
a8766181
JB
351## [2.5.0] - 2023-05-31
352
e4543b14
JB
353### Added
354
355- Switch pool event emitter to `EventEmitterAsyncResource`.
6da80d38 356- Add tasks wait time accounting in per worker tasks usage.
5af9c0f7 357- Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
e4543b14
JB
358
359### Changed
360
361- Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
362
570efb11
JB
363## [2.4.14] - 2023-05-09
364
b0f28bad
JB
365### Fixed
366
367- Ensure no undefined task runtime can land in the tasks history.
368- Fix median computation implementation once again.
369
110b6d13
JB
370### Added
371
372- Unit tests for median and queue implementations.
373
72584880
JB
374## [2.4.13] - 2023-05-08
375
b0d6ed8f
JB
376### Fixed
377
e3058615 378- Fix worker choice strategy options validation.
b0d6ed8f
JB
379- Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
380
06140c32
JB
381## [2.4.12] - 2023-05-06
382
a86b6df1
JB
383### Added
384
385- Support multiple task functions per worker.
08f3f44c 386- Add custom worker weights support to worker choice strategies options.
a86b6df1 387
29ee7e9a
JB
388### Changed
389
390- Use O(1) queue implementation for tasks queueing.
391
0682ba15
JB
392### Fixed
393
394- Fix median computation implementation.
395- Fix fair share worker choice strategy internals update.
396
936d53ec
JB
397## [2.4.11] - 2023-04-23
398
cb70b19d
JB
399### Changed
400
401- Optimize free worker finding in worker choice strategies.
402
15bb637a
JB
403## [2.4.10] - 2023-04-15
404
ef41a6e6
JB
405### Fixed
406
82ea6492 407- Fix typescript type definition for task function: ensure the input data is optional.
ef41a6e6
JB
408- Fix typescript type definition for pool execute(): ensure the input data is optional.
409
181eb2b4
JB
410## [2.4.9] - 2023-04-15
411
a20f0ba5
JB
412### Added
413
414- Add tasks queue enablement runtime setter to pool.
415- Add tasks queue options runtime setter to pool.
416- Add worker choice strategy options runtime setter to pool.
417
418### Changed
419
420- Remove the tasks queuing experimental status.
421
d4aeae5a
JB
422### Fixed
423
82ea6492 424- Fix task function type definition and validation.
2fc5cae3 425- Fix worker choice strategy options handling.
d4aeae5a 426
1d9e7023
JB
427## [2.4.8] - 2023-04-12
428
f9b4bbf8
JB
429### Fixed
430
431- Fix message between main worker and worker type definition for tasks.
432- Fix code documentation.
433
12ae3210
JB
434## [2.4.7] - 2023-04-11
435
7171d33f
JB
436### Added
437
438- Add worker tasks queue options to pool options.
439
e8bd29ce
JB
440### Fixed
441
442- Fix missing documentation.
443
42c7bc10
JB
444## [2.4.6] - 2023-04-10
445
681196cc
JB
446### Fixed
447
448- Ensure one task at a time is executed per worker with tasks queueing enabled.
1c6fe997 449- Properly count worker executing tasks with tasks queueing enabled.
681196cc 450
54d360e3
JB
451## [2.4.5] - 2023-04-09
452
3fafb1b2
JB
453### Added
454
9e775f96
JB
455- Use monotonic high resolution timer for worker tasks runtime.
456- Add worker tasks median runtime to statistics.
ff733df7 457- Add worker tasks queue (experimental).
3fafb1b2 458
92fa3eb6
JB
459## [2.4.4] - 2023-04-07
460
aee46736
JB
461### Added
462
463- Add `PoolEvents` enumeration and `PoolEvent` type.
464
36b5e78f
JB
465### Fixed
466
ff0c2b3e 467- Destroy worker only on alive check.
36b5e78f 468
9fb0f324
JB
469## [2.4.3] - 2023-04-07
470
28cf3617
JB
471### Fixed
472
473- Fix typedoc generation with inheritance.
474
848f0f27
JB
475## [2.4.2] - 2023-04-06
476
164d950a
JB
477### Added
478
479- Add `full` event to dynamic pool.
32417142 480- Keep worker choice strategy in memory for conditional reuse.
164d950a 481
78ab2555
JB
482### Fixed
483
484- Fix possible negative worker key at worker removal in worker choice strategies.
485
79aafe9f
JB
486## [2.4.1] - 2023-04-05
487
9cd39dd4
JB
488### Changed
489
490- Optimize worker choice strategy for dynamic pool.
491
965415bb
JB
492### Fixed
493
494- Ensure dynamic pool does not alter worker choice strategy expected behavior.
495
d8b60b1c
JB
496## [2.4.0] - 2023-04-04
497
c6bd2650
JB
498### Added
499
500- Add `LESS_BUSY` worker choice strategy.
501
502### Changed
503
504- Optimize worker storage in pool.
505- Optimize worker alive status check.
506- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
507- Optimize `LESS_USED` worker choice strategy.
508- Update benchmarks versus external threads pools.
509- Optimize tasks usage statistics requirements for worker choice strategy.
510
511### Fixed
512
513- Ensure trimmable characters are checked at pool initialization.
514- Fix message id integer overflow.
515- Fix pool worker removal in worker choice strategy internals.
516- Fix package publication with pnpm.
517
d0a3f018
JB
518## [2.4.0-3] - 2023-04-04
519
b2ede285
JB
520### Added
521
522- Add `LESS_BUSY` worker choice strategy.
523
524### Changed
525
526- Optimize worker storage in pool.
527- Optimize worker alive status check.
528- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
529- Optimize `LESS_USED` worker choice strategy.
530- Update benchmarks versus external threads pools.
531
532### Fixed
533
534- Ensure trimmable characters are checked at pool initialization.
535- Fix message id integer overflow.
536- Fix pool worker removal in worker choice strategy internals.
537- Fix package publication with pnpm.
538
a015ea40
JB
539## [2.4.0-2] - 2023-04-03
540
698f4bbc
JB
541### Added
542
543- Add `LESS_BUSY` worker choice strategy.
544
545### Changed
546
547- Optimize worker storage in pool.
548- Optimize worker alive status check.
549- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
550- Optimize `LESS_USED` worker choice strategy.
551
552### Fixed
553
554- Ensure trimmable characters are checked at pool initialization.
555- Fix message id integer overflow.
556- Fix pool worker removal in worker choice strategy internals.
557- Fix package publication with pnpm.
558
8fe15920
JB
559## [2.4.0-1] - 2023-04-03
560
5b301c28
JB
561### Added
562
563- Add `LESS_BUSY` worker choice strategy.
564
565### Changed
566
567- Optimize worker storage in pool.
568- Optimize worker alive status check.
569- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
570- Optimize `LESS_USED` worker choice strategy.
571
572### Fixed
573
574- Ensure trimmable characters are checked at pool initialization.
575- Fix message id integer overflow.
576- Fix pool worker removal in worker choice strategy internals.
577
2fb9ca9c
JB
578## [2.4.0-0] - 2023-04-03
579
168c526f
JB
580### Added
581
582- Add `LESS_BUSY` worker choice strategy.
583
1d71a908
JB
584### Changed
585
ffcbbad8 586- Optimize worker storage in pool.
1d71a908 587- Optimize worker alive status check.
65a60b3b 588- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
737c6d97 589- Optimize `LESS_USED` worker choice strategy.
1d71a908 590
ffcbbad8
JB
591### Fixed
592
593- Ensure trimmable characters are checked at pool initialization.
b4e75778 594- Fix message id integer overflow.
97a2abc3 595- Fix pool worker removal in worker choice strategy internals.
ffcbbad8 596
08372738
JB
597## [2.3.10] - 2023-03-18
598
710826bc
JB
599### Fixed
600
9606b474 601- Fix package.json `exports` syntax for ESM and CommonJS.
710826bc
JB
602
603### Changed
604
605- Permit SemVer pre-release publication.
76e5ac6f 606
e4796ecd
JB
607## [2.3.10-2] - 2023-03-18
608
6abad580
JB
609### Fixed
610
9606b474 611- Fix package.json `exports` syntax for ESM and CommonJS.
6abad580 612
a2ee98cc
JB
613## [2.3.10-1] - 2023-03-18
614
7e060cee
JB
615### Changed
616
90483887 617- Permit SemVer pre-release publication.
7e060cee 618
c81bfafb
JB
619## [2.3.10-0] - 2023-03-18
620
fe18768d
JB
621### Fixed
622
9606b474 623- Fix package.json `exports` syntax for ESM and CommonJS.
fe18768d 624
d7b78217
JB
625## [2.3.9] - 2023-03-18
626
ed6dd37f
JB
627### Changed
628
629- Introduce ESM module support along with CommonJS one.
630
631### Fixed
632
633- Fix brown paper bag bug referencing the same object literal.
634
68e2ad86
JB
635## [2.3.8] - 2023-03-18
636
ca6c7d70
JB
637### Changed
638
639- Switch internal benchmarking code to benny.
fbdedeb9
JB
640- Switch to TypeScript 5.x.x.
641- Switch rollup bundler plugins to core ones.
ed6dd37f 642- Switch to TSDoc syntax.
fbdedeb9 643- Enforce conventional commits.
ca6c7d70 644
d15211d4
JB
645### Fixed
646
647- Fix random integer generator.
fbdedeb9 648- Fix worker choice strategy pool type identification at initialization.
d15211d4 649
995705ea
JB
650## [2.3.7] - 2022-10-23
651
b953022b
JB
652### Changed
653
654- Switch to open collective FOSS project funding platform.
78cea37e
JB
655- Switch to ts-standard linter configuration on TypeScript code.
656
657### Fixed
658
659- Fixed missing async on pool execute method.
660- Fixed typing in TypeScript example.
661- Fixed types in unit tests.
b953022b 662
3b9f6953
JB
663## [2.3.6] - 2022-10-22
664
f80cead4
JB
665### Changed
666
667- Cleanup pool attributes and methods.
668- Refine error types thrown.
669
670### Fixed
671
672- Fix continuous integration build on windows.
673- Fix code coverage reporting by using c8 instead of nyc.
674
efc22107
JB
675## [2.3.5] - 2022-10-21
676
7a6a0a96
JB
677### Changed
678
a05c10de
JB
679- Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
680- Optimize tasks usage lookup implementation.
7a6a0a96 681
b4904890
JB
682### Fixed
683
684- Fix missed pool event emitter type export.
685- Fix typedoc documentation generation.
686
a875f8d1
JB
687## [2.3.4] - 2022-10-17
688
73cda448
JB
689### Added
690
691- Fully automate release process with release-it.
692
45a5a54c
JB
693### Changed
694
73cda448 695- Optimize fair share task scheduling algorithm implementation.
eb4a8a82 696- Update benchmarks versus external pools results with latest version.
45a5a54c 697
90ee1b18 698## [2.3.3] - 2022-10-15
1a76932b
JB
699
700### Added
701
702- Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
703
90ee1b18 704## [2.3.2] - 2022-10-14
11df3590
JB
705
706### Changed
707
708- Optimize fair share worker selection strategy implementation.
709
710### Fixed
711
712- Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
713
90ee1b18 714## [2.3.1] - 2022-10-13
23ff945a
JB
715
716### Added
717
718- Pool worker choice strategies:
719 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
720 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
721
90ee1b18 722## [2.2.2] - 2022-10-09
cb2b6c69
JB
723
724### Fixed
725
726- Fixed `README.md` file.
727
90ee1b18 728## [2.2.1] - 2022-10-08
bdacc2d2 729
bdaf31cd
JB
730### Added
731
732- Dynamic worker choice strategy change at runtime.
bdacc2d2 733
90ee1b18 734## [2.2.0] - 2022-01-05
7e0d447f
JB
735
736### Breaking Changes
737
9606b474 738- Support only Node.js version 16.x.x for cluster pool: upstream cluster API have changed on that version.
7e0d447f 739
90ee1b18 740## [2.1.0] - 2021-08-29
35cf1c03
JB
741
742### Added
743
744- Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
e088a00c
JB
745
746### Breaking Changes
747
748- `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
749- `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
750- `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
c365b2d3 751- `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
e088a00c 752
90ee1b18 753## [2.0.2] - 2021-05-12
14916bf9
JB
754
755### Bug fixes
756
757- Fix `busy` event emission on fixed pool type
758
90ee1b18 759## [2.0.1] - 2021-03-16
7f685093
JB
760
761### Bug fixes
762
763- Check if pool options are properly set.
764- `busy` event is emitted on all pool types.
765
90ee1b18 766## [2.0.0] - 2021-03-01
fa0f5b28 767
f3f833ab 768### Bug fixes
d63d3be3 769
ddbeaffd 770- Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
d63d3be3 771
fa0f5b28
S
772### Breaking Changes
773
7f685093 774- `FullPool` event is now renamed to `busy`.
1927ee67 775- `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
1a81f8af 776 _Find more details on our JSDoc._
ddbeaffd 777
1927ee67
APA
778- `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
779
ddbeaffd 780- We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
fa0f5b28 781
ec2ccfc8
JB
782### Pool options types declaration merge
783
784`FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
785
fa0f5b28
S
786#### New `export` strategy
787
788```js
789// Before
0eee77cb 790const DynamicThreadPool = require('poolifier/lib/dynamic')
fa0f5b28 791// After
0eee77cb 792const { DynamicThreadPool } = require('poolifier/lib/dynamic')
fa0f5b28
S
793```
794
795But you should always prefer just using
796
797```js
0eee77cb 798const { DynamicThreadPool } = require('poolifier')
fa0f5b28
S
799```
800
d3c8a1a8
S
801#### New type definitions for input data and response
802
6677a3d3 803For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data.
9606b474 804_This is not a limitation by poolifier but Node.js._
d3c8a1a8 805
3a4b605f 806#### Public property replacements
5c5a1fb7 807
3a4b605f 808`numWorkers` property is now `numberOfWorkers`
5c5a1fb7 809
280c2a77 810#### Internal (protected) properties and methods renaming
fa0f5b28 811
280c2a77
S
812These properties are not intended for end users
813
814- `id` => `nextMessageId`
815
816These methods are not intended for end users
fa0f5b28
S
817
818- `_chooseWorker` => `chooseWorker`
280c2a77 819- `_newWorker` => `createWorker`
fa0f5b28
S
820- `_execute` => `internalExecute`
821- `_chooseWorker` => `chooseWorker`
822- `_checkAlive` => `checkAlive`
823- `_run` => `run`
824- `_runAsync` => `runAsync`
825
90ee1b18 826## [1.1.0] - 2020-05-21
0312f71a
APA
827
828### Added
829
830- ThreadWorker support async functions as option
cf9aa6c3 831- Various external library patches
0312f71a 832
90ee1b18 833## [1.0.0] - 2020-01-24
522eea03 834
835### Added
836
837- FixedThreadPool implementation
838- DynamicThreadPool implementation
0312f71a 839- WorkerThread implementation to improve developer experience