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