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