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