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