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