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