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