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