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