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