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