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