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