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