Merge branch 'master' into feature/task-functions
[poolifier.git] / CHANGELOG.md
1 # Changelog
2
3 All notable changes to this project will be documented in this file.
4
5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
8 ## [Unreleased]
9
10 ### Fixed
11
12 - Fix task stealing related tasks queue options handling at runtime.
13
14 ### Changed
15
16 - Rename `listTaskFunctions()` to `listTaskFunctionNames()` in pool and worker API.
17
18 ### Added
19
20 - Add `hasTaskFunction()`, `addTaskFunction()`, `removeTaskFunction()`, `setDefaultTaskFunction()` methods to pool API.
21 - Stricter worker constructor arguments validation.
22
23 ## [2.6.45] - 2023-09-17
24
25 ### Changed
26
27 - Disable publication on GitHub packages registry on release until authentication issue is fixed.
28
29 ### Added
30
31 - Add `startWorkers` to pool options to whether start the minimum number of workers at pool creation or not.
32 - Add `start()` method to pool API to start the minimum number of workers.
33 - Add `taskStealing` and `tasksStealingOnPressure` to tasks queue options to whether enable task stealing or not and whether enable tasks stealing on back pressure or not.
34 - Continuous internal benchmarking: https://poolifier.github.io/benchmark-results/dev/bench.
35
36 ## [2.6.44] - 2023-09-08
37
38 ### Fixed
39
40 - Use a dedicated PAT to publish on GitHub packages registry.
41
42 ### Added
43
44 - Publish on GitHub packages registry on release.
45
46 ### Changed
47
48 - Switch from rome to biome: [PR #1128](https://github.com/poolifier/poolifier/pull/1128).
49
50 ## [2.6.43] - 2023-09-08
51
52 ### Added
53
54 - Publish on GitHub packages registry on release.
55
56 ### Changed
57
58 - Switch from rome to biome: [PR #1128](https://github.com/poolifier/poolifier/pull/1128).
59
60 ## [2.6.42] - 2023-09-06
61
62 ### Changed
63
64 - Optimize hot code paths implementation: avoid unnecessary branching, add and use optimized helpers (min, max), use reduce() array helper, ...
65
66 ## [2.6.41] - 2023-09-03
67
68 ### Changed
69
70 - Optimize worker choice strategies implementation.
71
72 ## [2.6.40] - 2023-09-01
73
74 ### Fixed
75
76 - Do not pre-choose in WRR worker choice strategy to avoid bias.
77 - Avoid array out of bound in worker choice strategies after worker node removal.
78
79 ## [2.6.39] - 2023-08-30
80
81 ### Fixed
82
83 - Fix race condition in worker choice strategies at worker node info querying while not yet initialized.
84
85 ## [2.6.38] - 2023-08-30
86
87 ### Added
88
89 - Bundle typescript types declaration into one file.
90
91 ### Changed
92
93 - Improve interleaved weighted round robin worker choice strategy implementation.
94
95 ## [2.6.37] - 2023-08-28
96
97 ### Fixed
98
99 - Ensure unused worker usage statistics are deleted at runtime.
100
101 ### Changed
102
103 - Rename worker choice strategy options `choiceRetries` to `retries`.
104 - Avoid unnecessary branching in worker choice strategies.
105
106 ## [2.6.36] - 2023-08-27
107
108 ### Fixed
109
110 - Fix pool `execute()` arguments check.
111
112 ### Changed
113
114 - Make continuous tasks stealing algorithm less aggressive.
115 - Fine tune tasks stealing algorithm under back pressure.
116
117 ## [2.6.35] - 2023-08-25
118
119 ### Fixed
120
121 - Don't account worker usage statistics for tasks that have failed.
122 - Fix pool information runtime and wait time median computation.
123
124 ### Changed
125
126 - Update simple moving average implementation to use a circular buffer.
127 - Update simple moving median implementation to use a circular buffer.
128 - Account for stolen tasks in worker usage statistics and pool information.
129
130 ### Added
131
132 - Continuous tasks stealing algorithm.
133
134 ## [2.6.34] - 2023-08-24
135
136 ### Fixes
137
138 - Avoid cascading tasks stealing under back pressure.
139
140 ### Changed
141
142 - Add fastpath to queued tasks rescheduling.
143
144 ## [2.6.33] - 2023-08-24
145
146 ### Fixed
147
148 - Fix queued tasks rescheduling.
149
150 ### Changed
151
152 - Rename tasks queue options `queueMaxSize` to `size`.
153
154 ### Added
155
156 - Task stealing scheduling algorithm if tasks queueing is enabled.
157
158 ## [2.6.32] - 2023-08-23
159
160 ### Fixed
161
162 - Ensure no task can be executed when the pool is destroyed.
163
164 ### Added
165
166 - Add `queueMaxSize` option to tasks queue options.
167 - Add O(1) deque implementation implemented with doubly linked list and use it for tasks queueing.
168 - Add tasks stealing algorithm when a worker node queue is back pressured if tasks queueing is enabled.
169
170 ## [2.6.31] - 2023-08-20
171
172 ### Fixed
173
174 - Fix worker choice strategy retries mechanism in some edge cases.
175
176 ### Changed
177
178 - Make orthogonal worker choice strategies tasks distribution and created dynamic worker usage.
179 - Remove the experimental status of the `LEAST_ELU` worker choice strategy.
180
181 ## [2.6.30] - 2023-08-19
182
183 ### Fixed
184
185 - Ensure pool event `backPressure` is emitted.
186 - Ensure pool event `full` is emitted only once.
187 - Ensure worker node cannot be instantiated without proper arguments.
188
189 ## [2.6.29] - 2023-08-18
190
191 ### Fixed
192
193 - Fix race condition between ready and task functions worker message handling at startup.
194 - Fix duplicate task function worker usage statistics computation per task function.
195 - Update task function worker usage statistics if and only if there's at least two different task functions.
196 - Fix race condition at task function worker usage executing task computation leading to negative value.
197
198 ### Added
199
200 - 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).
201 - Use back pressure detection in worker choice strategies.
202 - Add worker choice strategies retries mechanism if no worker is eligible.
203
204 ## [2.6.28] - 2023-08-16
205
206 ### Fixed
207
208 - Ensure pool workers are properly initialized.
209
210 ### Added
211
212 - HTTP server pool examples: express-cluster, express-hybrid.
213
214 ### Changed
215
216 - Remove now useless branching in worker hot code path.
217
218 ## [2.6.27] - 2023-08-15
219
220 ### Fixed
221
222 - Add `KillHandler` type definition to exported types.
223
224 ### Added
225
226 - Add `destroy` event to pool API.
227
228 ## [2.6.26] - 2023-08-15
229
230 ### Added
231
232 - Add kill handler to worker options allowing to execute custom code when worker is killed.
233 - Add `listTaskFunctions()` method to pool API.
234 - SMTP client pool example: nodemailer.
235
236 ## [2.6.25] - 2023-08-13
237
238 ### Added
239
240 - HTTP server pool examples: fastify-cluster, fastify-hybrid.
241 - WebSocket server pool examples: ws-cluster, ws-hybrid.
242
243 ## [2.6.24] - 2023-08-12
244
245 ### Added
246
247 - Add array of transferable objects to the `execute()` method arguments.
248 - WebSocket server pool examples: ws-worker_threads.
249
250 ## [2.6.23] - 2023-08-11
251
252 ### Fixed
253
254 - 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.
255
256 ### Added
257
258 - HTTP client pool examples: fetch, node-fetch and axios with multiple task functions.
259 - HTTP server pool examples: express-worker_threads, fastify-worker_threads.
260
261 ## [2.6.22] - 2023-08-10
262
263 ### Fixed
264
265 - Add missing `types` field to package.json `exports`.
266
267 ### Changed
268
269 - Structure markdown documentation (PR #811).
270
271 ## [2.6.21] - 2023-08-03
272
273 ### Changed
274
275 - Improve code documentation.
276 - Code refactoring and cleanup for better maintainability and readability.
277
278 ## [2.6.20] - 2023-07-21
279
280 ### Fixed
281
282 - Fix queued tasks redistribution on error task execution starvation.
283 - Ensure tasks queueing per worker condition is untangled from the pool busyness semantic.
284
285 ### Changed
286
287 - Drastically reduce lookups by worker in the worker nodes.
288
289 ## [2.6.19] - 2023-07-20
290
291 ### Added
292
293 - Dedicated internal communication channel for worker_threads pools.
294
295 ## [2.6.18] - 2023-07-19
296
297 ### Changed
298
299 - Code refactoring and cleanup for better maintainability and readability. Bundle size is a bit smaller.
300
301 ## [2.6.17] - 2023-07-16
302
303 ### Added
304
305 - Add `listTaskFunctions()` method to worker API.
306
307 ## [2.6.16] - 2023-07-12
308
309 ### Fixed
310
311 - Fix pool startup detection.
312 - Fix worker task functions handling.
313
314 ## [2.6.15] - 2023-07-11
315
316 ### Added
317
318 - Take into account worker node readiness in worker choice strategies.
319
320 ## [2.6.14] - 2023-07-10
321
322 ### Fixed
323
324 - Fix task function statistics tracking.
325
326 ## [2.6.13] - 2023-07-10
327
328 ### Added
329
330 - Add per task function statistics tracking.
331 - Add public methods to manipulate the worker task functions at runtime.
332
333 ## [2.6.12] - 2023-07-09
334
335 ### Fixed
336
337 - Workaround import issue with `node:os` module in node 16.x.x.
338
339 ## [2.6.11] - 2023-07-09
340
341 ### Fixed
342
343 - Fix pool readiness semantic.
344
345 ## [2.6.10] - 2023-07-08
346
347 ### Fixed
348
349 - Ensure workers are not recreated on error at pool startup.
350
351 ### Added
352
353 - Add `ready` and `strategy` fields to pool information.
354 - Add pool event `ready` to notify when the number of workers created in the pool has reached the maximum size expected and are ready.
355 - Add dynamic pool sizing checks.
356
357 ## [2.6.9] - 2023-07-07
358
359 ### Fixed
360
361 - Recreate the right worker type on uncaught exception.
362
363 ### Added
364
365 - Add minimum and maximum to internal measurement statistics.
366 - Add `runTime` and `waitTime` to pool information.
367 - Check worker inactive time only on dynamic worker.
368
369 ## [2.6.8] - 2023-07-03
370
371 ### Fixed
372
373 - Brown paper bag release to fix version handling in pool information.
374
375 ## [2.6.7] - 2023-07-03
376
377 ### Fixed
378
379 - Ensure worker queued tasks at error are reassigned to other pool workers.
380
381 ### Added
382
383 - Add pool `utilization` ratio to pool information.
384 - Add `version` to pool information.
385 - Add worker information to worker nodes.
386
387 ## [2.6.6] - 2023-07-01
388
389 ### Added
390
391 - Add safe helper `availableParallelism()` to help sizing the pool.
392
393 ### Fixed
394
395 - Ensure message handler is only registered in worker.
396
397 ## [2.6.5] - 2023-06-27
398
399 ### Known issues
400
401 - Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
402
403 ### Fixed
404
405 - Artificial version bump to 2.6.5 to workaround publication issue.
406 - Ensure cluster pool `destroy()` gracefully shutdowns worker's server.
407 - Ensure pool event is emitted before task error promise rejection.
408 - Fix queued tasks count computation.
409
410 ### Removed
411
412 - Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
413
414 ## [2.6.4] - 2023-06-27
415
416 ### Known issues
417
418 - Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
419
420 ### Fixed
421
422 - Ensure cluster pool `destroy()` gracefully shutdowns worker's server.
423 - Ensure pool event is emitted before task error promise rejection.
424 - Fix queued tasks count computation.
425
426 ### Removed
427
428 - Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
429
430 ## [2.6.3] - 2023-06-19
431
432 ### Fixed
433
434 - Ensure no tasks are queued when trying to soft kill a dynamic worker.
435 - Update strategies internals after statistics computation.
436
437 ### Changed
438
439 - Optimize O(1) queue implementation.
440
441 ## [2.6.2] - 2023-06-12
442
443 ### Fixed
444
445 - Fix new worker use after creation in dynamic pool given the current worker choice strategy.
446
447 ## [2.6.1] - 2023-06-10
448
449 ### Added
450
451 - Add worker choice strategy documentation: [README.md](./docs/worker-choice-strategies.md).
452
453 ### Fixed
454
455 - Fix average statistics computation: ensure failed tasks are not accounted.
456
457 ## [2.6.0] - 2023-06-09
458
459 ### Added
460
461 - Add `LEAST_ELU` worker choice strategy (experimental).
462 - Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
463
464 ### Changed
465
466 - Refactor pool worker node usage internals.
467 - Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
468 - Breaking change: pool information `info` property object fields have been renamed.
469
470 ### Fixed
471
472 - Fix wait time accounting.
473 - Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
474 - Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
475
476 ## [2.5.4] - 2023-06-07
477
478 ### Added
479
480 - Add Event Loop Utilization (ELU) statistics to worker tasks usage.
481
482 ### Changed
483
484 - Compute statistics at the worker level only if needed.
485 - Add `worker_threads` options to thread pool options.
486
487 ### Fixed
488
489 - Make the `LEAST_BUSY` strategy only relies on task runtime.
490
491 ## [2.5.3] - 2023-06-04
492
493 ### Changed
494
495 - Refine pool information content.
496 - Limit pool internals public exposure.
497
498 ## [2.5.2] - 2023-06-02
499
500 ### Added
501
502 - Add `taskError` pool event for task execution error.
503 - Add pool information `info` property to pool.
504 - Emit pool information on `busy` and `full` pool events.
505
506 ## [2.5.1] - 2023-06-01
507
508 ### Added
509
510 - Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
511 - Add `error` pool event for uncaught worker error.
512
513 ## [2.5.0] - 2023-05-31
514
515 ### Added
516
517 - Switch pool event emitter to `EventEmitterAsyncResource`.
518 - Add tasks wait time accounting in per worker tasks usage.
519 - Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
520
521 ### Changed
522
523 - Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
524
525 ## [2.4.14] - 2023-05-09
526
527 ### Fixed
528
529 - Ensure no undefined task runtime can land in the tasks history.
530 - Fix median computation implementation once again.
531
532 ### Added
533
534 - Unit tests for median and queue implementations.
535
536 ## [2.4.13] - 2023-05-08
537
538 ### Fixed
539
540 - Fix worker choice strategy options validation.
541 - Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
542
543 ## [2.4.12] - 2023-05-06
544
545 ### Added
546
547 - Support multiple task functions per worker.
548 - Add custom worker weights support to worker choice strategies options.
549
550 ### Changed
551
552 - Use O(1) queue implementation for tasks queueing.
553
554 ### Fixed
555
556 - Fix median computation implementation.
557 - Fix fair share worker choice strategy internals update.
558
559 ## [2.4.11] - 2023-04-23
560
561 ### Changed
562
563 - Optimize free worker finding in worker choice strategies.
564
565 ## [2.4.10] - 2023-04-15
566
567 ### Fixed
568
569 - Fix typescript type definition for task function: ensure the input data is optional.
570 - Fix typescript type definition for pool execute(): ensure the input data is optional.
571
572 ## [2.4.9] - 2023-04-15
573
574 ### Added
575
576 - Add tasks queue enablement runtime setter to pool.
577 - Add tasks queue options runtime setter to pool.
578 - Add worker choice strategy options runtime setter to pool.
579
580 ### Changed
581
582 - Remove the tasks queuing experimental status.
583
584 ### Fixed
585
586 - Fix task function type definition and validation.
587 - Fix worker choice strategy options handling.
588
589 ## [2.4.8] - 2023-04-12
590
591 ### Fixed
592
593 - Fix message between main worker and worker type definition for tasks.
594 - Fix code documentation.
595
596 ## [2.4.7] - 2023-04-11
597
598 ### Added
599
600 - Add worker tasks queue options to pool options.
601
602 ### Fixed
603
604 - Fix missing documentation.
605
606 ## [2.4.6] - 2023-04-10
607
608 ### Fixed
609
610 - Ensure one task at a time is executed per worker with tasks queueing enabled.
611 - Properly count worker executing tasks with tasks queueing enabled.
612
613 ## [2.4.5] - 2023-04-09
614
615 ### Added
616
617 - Use monotonic high resolution timer for worker tasks runtime.
618 - Add worker tasks median runtime to statistics.
619 - Add worker tasks queue (experimental).
620
621 ## [2.4.4] - 2023-04-07
622
623 ### Added
624
625 - Add `PoolEvents` enumeration and `PoolEvent` type.
626
627 ### Fixed
628
629 - Destroy worker only on alive check.
630
631 ## [2.4.3] - 2023-04-07
632
633 ### Fixed
634
635 - Fix typedoc generation with inheritance.
636
637 ## [2.4.2] - 2023-04-06
638
639 ### Added
640
641 - Add `full` event to dynamic pool.
642 - Keep worker choice strategy in memory for conditional reuse.
643
644 ### Fixed
645
646 - Fix possible negative worker key at worker removal in worker choice strategies.
647
648 ## [2.4.1] - 2023-04-05
649
650 ### Changed
651
652 - Optimize worker choice strategy for dynamic pool.
653
654 ### Fixed
655
656 - Ensure dynamic pool does not alter worker choice strategy expected behavior.
657
658 ## [2.4.0] - 2023-04-04
659
660 ### Added
661
662 - Add `LESS_BUSY` worker choice strategy.
663
664 ### Changed
665
666 - Optimize worker storage in pool.
667 - Optimize worker alive status check.
668 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
669 - Optimize `LESS_USED` worker choice strategy.
670 - Update benchmark versus external threads pools.
671 - Optimize tasks usage statistics requirements for worker choice strategy.
672
673 ### Fixed
674
675 - Ensure trimmable characters are checked at pool initialization.
676 - Fix message id integer overflow.
677 - Fix pool worker removal in worker choice strategy internals.
678 - Fix package publication with pnpm.
679
680 ## [2.4.0-3] - 2023-04-04
681
682 ### Added
683
684 - Add `LESS_BUSY` worker choice strategy.
685
686 ### Changed
687
688 - Optimize worker storage in pool.
689 - Optimize worker alive status check.
690 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
691 - Optimize `LESS_USED` worker choice strategy.
692 - Update benchmark versus external threads pools.
693
694 ### Fixed
695
696 - Ensure trimmable characters are checked at pool initialization.
697 - Fix message id integer overflow.
698 - Fix pool worker removal in worker choice strategy internals.
699 - Fix package publication with pnpm.
700
701 ## [2.4.0-2] - 2023-04-03
702
703 ### Added
704
705 - Add `LESS_BUSY` worker choice strategy.
706
707 ### Changed
708
709 - Optimize worker storage in pool.
710 - Optimize worker alive status check.
711 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
712 - Optimize `LESS_USED` worker choice strategy.
713
714 ### Fixed
715
716 - Ensure trimmable characters are checked at pool initialization.
717 - Fix message id integer overflow.
718 - Fix pool worker removal in worker choice strategy internals.
719 - Fix package publication with pnpm.
720
721 ## [2.4.0-1] - 2023-04-03
722
723 ### Added
724
725 - Add `LESS_BUSY` worker choice strategy.
726
727 ### Changed
728
729 - Optimize worker storage in pool.
730 - Optimize worker alive status check.
731 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
732 - Optimize `LESS_USED` worker choice strategy.
733
734 ### Fixed
735
736 - Ensure trimmable characters are checked at pool initialization.
737 - Fix message id integer overflow.
738 - Fix pool worker removal in worker choice strategy internals.
739
740 ## [2.4.0-0] - 2023-04-03
741
742 ### Added
743
744 - Add `LESS_BUSY` worker choice strategy.
745
746 ### Changed
747
748 - Optimize worker storage in pool.
749 - Optimize worker alive status check.
750 - BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
751 - Optimize `LESS_USED` worker choice strategy.
752
753 ### Fixed
754
755 - Ensure trimmable characters are checked at pool initialization.
756 - Fix message id integer overflow.
757 - Fix pool worker removal in worker choice strategy internals.
758
759 ## [2.3.10] - 2023-03-18
760
761 ### Fixed
762
763 - Fix package.json `exports` syntax for ESM and CommonJS.
764
765 ### Changed
766
767 - Permit SemVer pre-release publication.
768
769 ## [2.3.10-2] - 2023-03-18
770
771 ### Fixed
772
773 - Fix package.json `exports` syntax for ESM and CommonJS.
774
775 ## [2.3.10-1] - 2023-03-18
776
777 ### Changed
778
779 - Permit SemVer pre-release publication.
780
781 ## [2.3.10-0] - 2023-03-18
782
783 ### Fixed
784
785 - Fix package.json `exports` syntax for ESM and CommonJS.
786
787 ## [2.3.9] - 2023-03-18
788
789 ### Changed
790
791 - Introduce ESM module support along with CommonJS one.
792
793 ### Fixed
794
795 - Fix brown paper bag bug referencing the same object literal.
796
797 ## [2.3.8] - 2023-03-18
798
799 ### Changed
800
801 - Switch internal benchmarking code to benny.
802 - Switch to TypeScript 5.x.x.
803 - Switch rollup bundler plugins to core ones.
804 - Switch to TSDoc syntax.
805 - Enforce conventional commits.
806
807 ### Fixed
808
809 - Fix random integer generator.
810 - Fix worker choice strategy pool type identification at initialization.
811
812 ## [2.3.7] - 2022-10-23
813
814 ### Changed
815
816 - Switch to open collective FOSS project funding platform.
817 - Switch to ts-standard linter configuration on TypeScript code.
818
819 ### Fixed
820
821 - Fixed missing async on pool execute method.
822 - Fixed typing in TypeScript example.
823 - Fixed types in unit tests.
824
825 ## [2.3.6] - 2022-10-22
826
827 ### Changed
828
829 - Cleanup pool attributes and methods.
830 - Refine error types thrown.
831
832 ### Fixed
833
834 - Fix continuous integration build on windows.
835 - Fix code coverage reporting by using c8 instead of nyc.
836
837 ## [2.3.5] - 2022-10-21
838
839 ### Changed
840
841 - Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
842 - Optimize tasks usage lookup implementation.
843
844 ### Fixed
845
846 - Fix missed pool event emitter type export.
847 - Fix typedoc documentation generation.
848
849 ## [2.3.4] - 2022-10-17
850
851 ### Added
852
853 - Fully automate release process with release-it.
854
855 ### Changed
856
857 - Optimize fair share task scheduling algorithm implementation.
858 - Update benchmark versus external pools results with latest version.
859
860 ## [2.3.3] - 2022-10-15
861
862 ### Added
863
864 - Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
865
866 ## [2.3.2] - 2022-10-14
867
868 ### Changed
869
870 - Optimize fair share worker selection strategy implementation.
871
872 ### Fixed
873
874 - Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
875
876 ## [2.3.1] - 2022-10-13
877
878 ### Added
879
880 - Pool worker choice strategies:
881 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
882 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
883
884 ## [2.2.2] - 2022-10-09
885
886 ### Fixed
887
888 - Fixed `README.md` file.
889
890 ## [2.2.1] - 2022-10-08
891
892 ### Added
893
894 - Dynamic worker choice strategy change at runtime.
895
896 ## [2.2.0] - 2022-01-05
897
898 ### Breaking Changes
899
900 - Support only Node.js version 16.x.x for cluster pool: upstream cluster API have changed on that version.
901
902 ## [2.1.0] - 2021-08-29
903
904 ### Added
905
906 - Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
907
908 ### Breaking Changes
909
910 - `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
911 - `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
912 - `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
913 - `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
914
915 ## [2.0.2] - 2021-05-12
916
917 ### Bug fixes
918
919 - Fix `busy` event emission on fixed pool type
920
921 ## [2.0.1] - 2021-03-16
922
923 ### Bug fixes
924
925 - Check if pool options are properly set.
926 - `busy` event is emitted on all pool types.
927
928 ## [2.0.0] - 2021-03-01
929
930 ### Bug fixes
931
932 - Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
933
934 ### Breaking Changes
935
936 - `FullPool` event is now renamed to `busy`.
937 - `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
938 _Find more details on our JSDoc._
939
940 - `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
941
942 - We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
943
944 ### Pool options types declaration merge
945
946 `FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
947
948 #### New `export` strategy
949
950 ```js
951 // Before
952 const DynamicThreadPool = require('poolifier/lib/dynamic')
953 // After
954 const { DynamicThreadPool } = require('poolifier/lib/dynamic')
955 ```
956
957 But you should always prefer just using
958
959 ```js
960 const { DynamicThreadPool } = require('poolifier')
961 ```
962
963 #### New type definitions for input data and response
964
965 For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data.
966 _This is not a limitation by poolifier but Node.js._
967
968 #### Public property replacements
969
970 `numWorkers` property is now `numberOfWorkers`
971
972 #### Internal (protected) properties and methods renaming
973
974 These properties are not intended for end users
975
976 - `id` => `nextMessageId`
977
978 These methods are not intended for end users
979
980 - `_chooseWorker` => `chooseWorker`
981 - `_newWorker` => `createWorker`
982 - `_execute` => `internalExecute`
983 - `_chooseWorker` => `chooseWorker`
984 - `_checkAlive` => `checkAlive`
985 - `_run` => `run`
986 - `_runAsync` => `runAsync`
987
988 ## [1.1.0] - 2020-05-21
989
990 ### Added
991
992 - ThreadWorker support async functions as option
993 - Various external library patches
994
995 ## [1.0.0] - 2020-01-24
996
997 ### Added
998
999 - FixedThreadPool implementation
1000 - DynamicThreadPool implementation
1001 - WorkerThread implementation to improve developer experience