fix: ensure worker node cannot be instantiaed without proper arguments
[poolifier.git] / CHANGELOG.md
CommitLineData
522eea03 1# Changelog
2
3All notable changes to this project will be documented in this file.
4
d4abc60a 5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
522eea03 6and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
45a5a54c
JB
8## [Unreleased]
9
33e6bb4c
JB
10### Fixed
11
12- Ensure pool event `backPressure` is emitted.
13- Ensure pool event `full` is emitted only once.
8735b4e5 14- Ensure worker node cannot be instantiated without proper arguments.
33e6bb4c 15
8cc4ea81
JB
16## [2.6.29] - 2023-08-18
17
6169563b
JB
18### Fixed
19
20- Fix race condition between ready and task functions worker message handling at startup.
5dd4043c 21- Fix duplicate task function worker usage statistics computation per task function.
db0e38ee 22- Update task function worker usage statistics if and only if there's at least two different task functions.
5bb5be17 23- Fix race condition at task function worker usage executing task computation leading to negative value.
6169563b 24
8990357d
JB
25### Added
26
445264e8 27- 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).
8990357d
JB
28- Use back pressure detection in worker choice strategies.
29- Add worker choice strategies retries mechanism if no worker is eligible.
30
21157987
JB
31## [2.6.28] - 2023-08-16
32
f05ed93c
JB
33### Fixed
34
35- Ensure pool workers are properly initialized.
36
12d67776
JB
37### Added
38
39- HTTP server pool examples: express-cluster, express-hybrid.
40
d18fccb1
JB
41### Changed
42
43- Remove now useless branching in worker hot code path.
44
741cdb34
JB
45## [2.6.27] - 2023-08-15
46
50e7f498
JB
47### Fixed
48
49- Add `KillHandler` type definition to exported types.
50
ef3891a3
JB
51### Added
52
53- Add `destroy` event to pool API.
54
e9dc6efa
JB
55## [2.6.26] - 2023-08-15
56
2b099bf7
JB
57### Added
58
59- Add kill handler to worker options allowing to execute custom code when worker is killed.
ef3891a3 60- Add `listTaskFunctions()` method to pool API.
9aef1431 61- SMTP server pool example: nodemailer.
2b099bf7 62
5b726f72
JB
63## [2.6.25] - 2023-08-13
64
72855e92
JB
65### Added
66
3b311539 67- HTTP server pool examples: fastify-cluster, fastify-hybrid.
02999424 68- WebSocket server pool examples: ws-cluster, ws-hybrid.
72855e92 69
7aadd6e5
JB
70## [2.6.24] - 2023-08-12
71
7d91a8cd
JB
72### Added
73
74- Add array of transferable objects to the `execute()` method arguments.
02999424 75- WebSocket server pool examples: ws-worker_threads.
7d91a8cd 76
6b4263b4
JB
77## [2.6.23] - 2023-08-11
78
3d76750a 79### Fixed
8e0af894 80
3d76750a 81- 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.
9606b474 82
3d76750a
JB
83### Added
84
85- HTTP client pool examples: fetch, node-fetch and axios with multiple task functions.
02999424 86- HTTP server pool examples: express-worker_threads, fastify-worker_threads.
3d76750a
JB
87
88## [2.6.22] - 2023-08-10
9606b474 89
3d76750a 90### Fixed
9606b474
JB
91
92- Add missing `types` field to package.json `exports`.
93
3d76750a
JB
94### Changed
95
96- Structure markdown documentation (PR #811).
97
d9647bdd
JB
98## [2.6.21] - 2023-08-03
99
2111ec12
JB
100### Changed
101
102- Improve code documentation.
103- Code refactoring and cleanup for better maintainability and readability.
104
5c30b9d9
JB
105## [2.6.20] - 2023-07-21
106
10ecf8fd
JB
107### Fixed
108
109- Fix queued tasks redistribution on error task execution starvation.
a1763c54 110- Ensure tasks queueing per worker condition is untangled from the pool busyness semantic.
10ecf8fd 111
aa9eede8
JB
112### Changed
113
7c89e6a4 114- Drastically reduce lookups by worker in the worker nodes.
aa9eede8 115
62485908
JB
116## [2.6.19] - 2023-07-20
117
2e2ef9c3
JB
118### Added
119
120- Dedicated internal communication channel for worker_threads pools.
121
8f4c9491
JB
122## [2.6.18] - 2023-07-19
123
8660b972
JB
124### Changed
125
126- Code refactoring and cleanup for better maintainability and readability. Bundle size is a bit smaller.
127
206a3519
JB
128## [2.6.17] - 2023-07-16
129
b4899fae
JB
130### Added
131
1a3e01ba 132- Add `listTaskFunctions()` method to worker API.
b4899fae 133
58a06a6c
JB
134## [2.6.16] - 2023-07-12
135
2a69b8c5
JB
136### Fixed
137
80520ca4 138- Fix pool startup detection.
2a69b8c5
JB
139- Fix worker task functions handling.
140
b5900b02
JB
141## [2.6.15] - 2023-07-11
142
19dbc45b
JB
143### Added
144
145- Take into account worker node readiness in worker choice strategies.
146
4a0db581
JB
147## [2.6.14] - 2023-07-10
148
87e44747
JB
149### Fixed
150
151- Fix task function statistics tracking.
152
0265272f
JB
153## [2.6.13] - 2023-07-10
154
968a2e8c
JB
155### Added
156
157- Add per task function statistics tracking.
782299f8 158- Add public methods to manipulate the worker task functions at runtime.
968a2e8c 159
44c8c00f
JB
160## [2.6.12] - 2023-07-09
161
aa4bf4b2
JB
162### Fixed
163
164- Workaround import issue with `node:os` module in node 16.x.x.
165
b7cfced1
JB
166## [2.6.11] - 2023-07-09
167
d5024c00
JB
168### Fixed
169
170- Fix pool readiness semantic.
171
f313a208
JB
172## [2.6.10] - 2023-07-08
173
2431bdb4
JB
174### Fixed
175
176- Ensure workers are not recreated on error at pool startup.
177
178### Added
179
180- Add `ready` and `strategy` fields to pool information.
181- Add pool event `ready` to notify when the number of workers created in the pool has reached the maximum size expected and are ready.
caadbd41 182- Add dynamic pool sizing checks.
2431bdb4 183
369d0a51
JB
184## [2.6.9] - 2023-07-07
185
2845f2a5
JB
186### Fixed
187
188- Recreate the right worker type on uncaught exception.
189
190### Added
191
192- Add minimum and maximum to internal measurement statistics.
1dcf8b7b 193- Add `runTime` and `waitTime` to pool information.
75d3401a 194- Check worker inactive time only on dynamic worker.
2845f2a5 195
fc97d613
JB
196## [2.6.8] - 2023-07-03
197
92b1feaa
JB
198### Fixed
199
200- Brown paper bag release to fix version handling in pool information.
201
52d54060
JB
202## [2.6.7] - 2023-07-03
203
5bc91f3e
JB
204### Fixed
205
206- Ensure worker queued tasks at error are reassigned to other pool workers.
207
afe0d5bf
JB
208### Added
209
210- Add pool `utilization` ratio to pool information.
23ccf9d7 211- Add `version` to pool information.
e5b3047d 212- Add worker information to worker nodes.
afe0d5bf 213
f42c583f
JB
214## [2.6.6] - 2023-07-01
215
6961ca9a
JB
216### Added
217
d5e3c4ff 218- Add safe helper `availableParallelism()` to help sizing the pool.
6961ca9a 219
3749facb
JB
220### Fixed
221
222- Ensure message handler is only registered in worker.
223
6fed2513
JB
224## [2.6.5] - 2023-06-27
225
c72f6987
JB
226### Known issues
227
70726c28 228- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
c72f6987
JB
229
230### Fixed
231
232- Artificial version bump to 2.6.5 to workaround publication issue.
d5e3c4ff 233- Ensure cluster pool `destroy()` gracefully shutdowns worker's server.
c72f6987
JB
234- Ensure pool event is emitted before task error promise rejection.
235- Fix queued tasks count computation.
236
237### Removed
238
2fbe1783 239- Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
c72f6987 240
6426631b
JB
241## [2.6.4] - 2023-06-27
242
941f9a7c
JB
243### Known issues
244
70726c28 245- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
941f9a7c 246
2c039e43
JB
247### Fixed
248
d5e3c4ff 249- Ensure cluster pool `destroy()` gracefully shutdowns worker's server.
2c039e43 250- Ensure pool event is emitted before task error promise rejection.
9c16fb4b 251- Fix queued tasks count computation.
2c039e43 252
941f9a7c
JB
253### Removed
254
2fbe1783 255- Remove unneeded worker_threads worker `MessageChannel` internal usage for IPC.
941f9a7c 256
bc1b0765
JB
257## [2.6.3] - 2023-06-19
258
a6a2dc4c
JB
259### Fixed
260
261- Ensure no tasks are queued when trying to soft kill a dynamic worker.
f0d7f803 262- Update strategies internals after statistics computation.
a6a2dc4c 263
7b56f532
JB
264### Changed
265
266- Optimize O(1) queue implementation.
267
b628596c
JB
268## [2.6.2] - 2023-06-12
269
a9e89d00
JB
270### Fixed
271
272- Fix new worker use after creation in dynamic pool given the current worker choice strategy.
273
4368a898
JB
274## [2.6.1] - 2023-06-10
275
931d43e2
JB
276### Added
277
13ab5b87 278- Add worker choice strategy documentation: [README.md](./docs/worker-choice-strategies.md).
931d43e2 279
f1c06930
JB
280### Fixed
281
282- Fix average statistics computation: ensure failed tasks are not accounted.
283
16671b07
JB
284## [2.6.0] - 2023-06-09
285
a1347286
JB
286### Added
287
5af9c0f7 288- Add `LEAST_ELU` worker choice strategy (experimental).
9adcefab 289- Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
a1347286 290
1c6fe997
JB
291### Changed
292
293- Refactor pool worker node usage internals.
477f48e7 294- Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
f63a9dda 295- Breaking change: pool information `info` property object fields have been renamed.
1c6fe997
JB
296
297### Fixed
298
299- Fix wait time accounting.
300- Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
301- Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
302
aa07d6ee
JB
303## [2.5.4] - 2023-06-07
304
b6b32453
JB
305### Added
306
307- Add Event Loop Utilization (ELU) statistics to worker tasks usage.
308
309### Changed
310
311- Compute statistics at the worker level only if needed.
2fbe1783 312- Add `worker_threads` options to thread pool options.
b6b32453 313
272d4d8f
JB
314### Fixed
315
316- Make the `LEAST_BUSY` strategy only relies on task runtime.
317
ed47fb3d
JB
318## [2.5.3] - 2023-06-04
319
89a4abfd
JB
320### Changed
321
322- Refine pool information content.
b4213b7f 323- Limit pool internals public exposure.
89a4abfd 324
8a9febf5
JB
325## [2.5.2] - 2023-06-02
326
91ee39ed
JB
327### Added
328
329- Add `taskError` pool event for task execution error.
6b27d407 330- Add pool information `info` property to pool.
91ee39ed
JB
331- Emit pool information on `busy` and `full` pool events.
332
8babb151
JB
333## [2.5.1] - 2023-06-01
334
0e05c4dc
JB
335### Added
336
1f68cede 337- Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
91ee39ed 338- Add `error` pool event for uncaught worker error.
0e05c4dc 339
a8766181
JB
340## [2.5.0] - 2023-05-31
341
e4543b14
JB
342### Added
343
344- Switch pool event emitter to `EventEmitterAsyncResource`.
6da80d38 345- Add tasks wait time accounting in per worker tasks usage.
5af9c0f7 346- Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
e4543b14
JB
347
348### Changed
349
350- Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
351
570efb11
JB
352## [2.4.14] - 2023-05-09
353
b0f28bad
JB
354### Fixed
355
356- Ensure no undefined task runtime can land in the tasks history.
357- Fix median computation implementation once again.
358
110b6d13
JB
359### Added
360
361- Unit tests for median and queue implementations.
362
72584880
JB
363## [2.4.13] - 2023-05-08
364
b0d6ed8f
JB
365### Fixed
366
e3058615 367- Fix worker choice strategy options validation.
b0d6ed8f
JB
368- Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
369
06140c32
JB
370## [2.4.12] - 2023-05-06
371
a86b6df1
JB
372### Added
373
374- Support multiple task functions per worker.
08f3f44c 375- Add custom worker weights support to worker choice strategies options.
a86b6df1 376
29ee7e9a
JB
377### Changed
378
379- Use O(1) queue implementation for tasks queueing.
380
0682ba15
JB
381### Fixed
382
383- Fix median computation implementation.
384- Fix fair share worker choice strategy internals update.
385
936d53ec
JB
386## [2.4.11] - 2023-04-23
387
cb70b19d
JB
388### Changed
389
390- Optimize free worker finding in worker choice strategies.
391
15bb637a
JB
392## [2.4.10] - 2023-04-15
393
ef41a6e6
JB
394### Fixed
395
82ea6492 396- Fix typescript type definition for task function: ensure the input data is optional.
ef41a6e6
JB
397- Fix typescript type definition for pool execute(): ensure the input data is optional.
398
181eb2b4
JB
399## [2.4.9] - 2023-04-15
400
a20f0ba5
JB
401### Added
402
403- Add tasks queue enablement runtime setter to pool.
404- Add tasks queue options runtime setter to pool.
405- Add worker choice strategy options runtime setter to pool.
406
407### Changed
408
409- Remove the tasks queuing experimental status.
410
d4aeae5a
JB
411### Fixed
412
82ea6492 413- Fix task function type definition and validation.
2fc5cae3 414- Fix worker choice strategy options handling.
d4aeae5a 415
1d9e7023
JB
416## [2.4.8] - 2023-04-12
417
f9b4bbf8
JB
418### Fixed
419
420- Fix message between main worker and worker type definition for tasks.
421- Fix code documentation.
422
12ae3210
JB
423## [2.4.7] - 2023-04-11
424
7171d33f
JB
425### Added
426
427- Add worker tasks queue options to pool options.
428
e8bd29ce
JB
429### Fixed
430
431- Fix missing documentation.
432
42c7bc10
JB
433## [2.4.6] - 2023-04-10
434
681196cc
JB
435### Fixed
436
437- Ensure one task at a time is executed per worker with tasks queueing enabled.
1c6fe997 438- Properly count worker executing tasks with tasks queueing enabled.
681196cc 439
54d360e3
JB
440## [2.4.5] - 2023-04-09
441
3fafb1b2
JB
442### Added
443
9e775f96
JB
444- Use monotonic high resolution timer for worker tasks runtime.
445- Add worker tasks median runtime to statistics.
ff733df7 446- Add worker tasks queue (experimental).
3fafb1b2 447
92fa3eb6
JB
448## [2.4.4] - 2023-04-07
449
aee46736
JB
450### Added
451
452- Add `PoolEvents` enumeration and `PoolEvent` type.
453
36b5e78f
JB
454### Fixed
455
ff0c2b3e 456- Destroy worker only on alive check.
36b5e78f 457
9fb0f324
JB
458## [2.4.3] - 2023-04-07
459
28cf3617
JB
460### Fixed
461
462- Fix typedoc generation with inheritance.
463
848f0f27
JB
464## [2.4.2] - 2023-04-06
465
164d950a
JB
466### Added
467
468- Add `full` event to dynamic pool.
32417142 469- Keep worker choice strategy in memory for conditional reuse.
164d950a 470
78ab2555
JB
471### Fixed
472
473- Fix possible negative worker key at worker removal in worker choice strategies.
474
79aafe9f
JB
475## [2.4.1] - 2023-04-05
476
9cd39dd4
JB
477### Changed
478
479- Optimize worker choice strategy for dynamic pool.
480
965415bb
JB
481### Fixed
482
483- Ensure dynamic pool does not alter worker choice strategy expected behavior.
484
d8b60b1c
JB
485## [2.4.0] - 2023-04-04
486
c6bd2650
JB
487### Added
488
489- Add `LESS_BUSY` worker choice strategy.
490
491### Changed
492
493- Optimize worker storage in pool.
494- Optimize worker alive status check.
495- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
496- Optimize `LESS_USED` worker choice strategy.
497- Update benchmarks versus external threads pools.
498- Optimize tasks usage statistics requirements for worker choice strategy.
499
500### Fixed
501
502- Ensure trimmable characters are checked at pool initialization.
503- Fix message id integer overflow.
504- Fix pool worker removal in worker choice strategy internals.
505- Fix package publication with pnpm.
506
d0a3f018
JB
507## [2.4.0-3] - 2023-04-04
508
b2ede285
JB
509### Added
510
511- Add `LESS_BUSY` worker choice strategy.
512
513### Changed
514
515- Optimize worker storage in pool.
516- Optimize worker alive status check.
517- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
518- Optimize `LESS_USED` worker choice strategy.
519- Update benchmarks versus external threads pools.
520
521### Fixed
522
523- Ensure trimmable characters are checked at pool initialization.
524- Fix message id integer overflow.
525- Fix pool worker removal in worker choice strategy internals.
526- Fix package publication with pnpm.
527
a015ea40
JB
528## [2.4.0-2] - 2023-04-03
529
698f4bbc
JB
530### Added
531
532- Add `LESS_BUSY` worker choice strategy.
533
534### Changed
535
536- Optimize worker storage in pool.
537- Optimize worker alive status check.
538- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
539- Optimize `LESS_USED` worker choice strategy.
540
541### Fixed
542
543- Ensure trimmable characters are checked at pool initialization.
544- Fix message id integer overflow.
545- Fix pool worker removal in worker choice strategy internals.
546- Fix package publication with pnpm.
547
8fe15920
JB
548## [2.4.0-1] - 2023-04-03
549
5b301c28
JB
550### Added
551
552- Add `LESS_BUSY` worker choice strategy.
553
554### Changed
555
556- Optimize worker storage in pool.
557- Optimize worker alive status check.
558- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
559- Optimize `LESS_USED` worker choice strategy.
560
561### Fixed
562
563- Ensure trimmable characters are checked at pool initialization.
564- Fix message id integer overflow.
565- Fix pool worker removal in worker choice strategy internals.
566
2fb9ca9c
JB
567## [2.4.0-0] - 2023-04-03
568
168c526f
JB
569### Added
570
571- Add `LESS_BUSY` worker choice strategy.
572
1d71a908
JB
573### Changed
574
ffcbbad8 575- Optimize worker storage in pool.
1d71a908 576- Optimize worker alive status check.
65a60b3b 577- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
737c6d97 578- Optimize `LESS_USED` worker choice strategy.
1d71a908 579
ffcbbad8
JB
580### Fixed
581
582- Ensure trimmable characters are checked at pool initialization.
b4e75778 583- Fix message id integer overflow.
97a2abc3 584- Fix pool worker removal in worker choice strategy internals.
ffcbbad8 585
08372738
JB
586## [2.3.10] - 2023-03-18
587
710826bc
JB
588### Fixed
589
9606b474 590- Fix package.json `exports` syntax for ESM and CommonJS.
710826bc
JB
591
592### Changed
593
594- Permit SemVer pre-release publication.
76e5ac6f 595
e4796ecd
JB
596## [2.3.10-2] - 2023-03-18
597
6abad580
JB
598### Fixed
599
9606b474 600- Fix package.json `exports` syntax for ESM and CommonJS.
6abad580 601
a2ee98cc
JB
602## [2.3.10-1] - 2023-03-18
603
7e060cee
JB
604### Changed
605
90483887 606- Permit SemVer pre-release publication.
7e060cee 607
c81bfafb
JB
608## [2.3.10-0] - 2023-03-18
609
fe18768d
JB
610### Fixed
611
9606b474 612- Fix package.json `exports` syntax for ESM and CommonJS.
fe18768d 613
d7b78217
JB
614## [2.3.9] - 2023-03-18
615
ed6dd37f
JB
616### Changed
617
618- Introduce ESM module support along with CommonJS one.
619
620### Fixed
621
622- Fix brown paper bag bug referencing the same object literal.
623
68e2ad86
JB
624## [2.3.8] - 2023-03-18
625
ca6c7d70
JB
626### Changed
627
628- Switch internal benchmarking code to benny.
fbdedeb9
JB
629- Switch to TypeScript 5.x.x.
630- Switch rollup bundler plugins to core ones.
ed6dd37f 631- Switch to TSDoc syntax.
fbdedeb9 632- Enforce conventional commits.
ca6c7d70 633
d15211d4
JB
634### Fixed
635
636- Fix random integer generator.
fbdedeb9 637- Fix worker choice strategy pool type identification at initialization.
d15211d4 638
995705ea
JB
639## [2.3.7] - 2022-10-23
640
b953022b
JB
641### Changed
642
643- Switch to open collective FOSS project funding platform.
78cea37e
JB
644- Switch to ts-standard linter configuration on TypeScript code.
645
646### Fixed
647
648- Fixed missing async on pool execute method.
649- Fixed typing in TypeScript example.
650- Fixed types in unit tests.
b953022b 651
3b9f6953
JB
652## [2.3.6] - 2022-10-22
653
f80cead4
JB
654### Changed
655
656- Cleanup pool attributes and methods.
657- Refine error types thrown.
658
659### Fixed
660
661- Fix continuous integration build on windows.
662- Fix code coverage reporting by using c8 instead of nyc.
663
efc22107
JB
664## [2.3.5] - 2022-10-21
665
7a6a0a96
JB
666### Changed
667
a05c10de
JB
668- Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
669- Optimize tasks usage lookup implementation.
7a6a0a96 670
b4904890
JB
671### Fixed
672
673- Fix missed pool event emitter type export.
674- Fix typedoc documentation generation.
675
a875f8d1
JB
676## [2.3.4] - 2022-10-17
677
73cda448
JB
678### Added
679
680- Fully automate release process with release-it.
681
45a5a54c
JB
682### Changed
683
73cda448 684- Optimize fair share task scheduling algorithm implementation.
eb4a8a82 685- Update benchmarks versus external pools results with latest version.
45a5a54c 686
90ee1b18 687## [2.3.3] - 2022-10-15
1a76932b
JB
688
689### Added
690
691- Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
692
90ee1b18 693## [2.3.2] - 2022-10-14
11df3590
JB
694
695### Changed
696
697- Optimize fair share worker selection strategy implementation.
698
699### Fixed
700
701- Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
702
90ee1b18 703## [2.3.1] - 2022-10-13
23ff945a
JB
704
705### Added
706
707- Pool worker choice strategies:
708 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
709 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
710
90ee1b18 711## [2.2.2] - 2022-10-09
cb2b6c69
JB
712
713### Fixed
714
715- Fixed `README.md` file.
716
90ee1b18 717## [2.2.1] - 2022-10-08
bdacc2d2 718
bdaf31cd
JB
719### Added
720
721- Dynamic worker choice strategy change at runtime.
bdacc2d2 722
90ee1b18 723## [2.2.0] - 2022-01-05
7e0d447f
JB
724
725### Breaking Changes
726
9606b474 727- Support only Node.js version 16.x.x for cluster pool: upstream cluster API have changed on that version.
7e0d447f 728
90ee1b18 729## [2.1.0] - 2021-08-29
35cf1c03
JB
730
731### Added
732
733- Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
e088a00c
JB
734
735### Breaking Changes
736
737- `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
738- `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
739- `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
c365b2d3 740- `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
e088a00c 741
90ee1b18 742## [2.0.2] - 2021-05-12
14916bf9
JB
743
744### Bug fixes
745
746- Fix `busy` event emission on fixed pool type
747
90ee1b18 748## [2.0.1] - 2021-03-16
7f685093
JB
749
750### Bug fixes
751
752- Check if pool options are properly set.
753- `busy` event is emitted on all pool types.
754
90ee1b18 755## [2.0.0] - 2021-03-01
fa0f5b28 756
f3f833ab 757### Bug fixes
d63d3be3 758
ddbeaffd 759- Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
d63d3be3 760
fa0f5b28
S
761### Breaking Changes
762
7f685093 763- `FullPool` event is now renamed to `busy`.
1927ee67 764- `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
1a81f8af 765 _Find more details on our JSDoc._
ddbeaffd 766
1927ee67
APA
767- `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
768
ddbeaffd 769- We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
fa0f5b28 770
ec2ccfc8
JB
771### Pool options types declaration merge
772
773`FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
774
fa0f5b28
S
775#### New `export` strategy
776
777```js
778// Before
0eee77cb 779const DynamicThreadPool = require('poolifier/lib/dynamic')
fa0f5b28 780// After
0eee77cb 781const { DynamicThreadPool } = require('poolifier/lib/dynamic')
fa0f5b28
S
782```
783
784But you should always prefer just using
785
786```js
0eee77cb 787const { DynamicThreadPool } = require('poolifier')
fa0f5b28
S
788```
789
d3c8a1a8
S
790#### New type definitions for input data and response
791
6677a3d3 792For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data.
9606b474 793_This is not a limitation by poolifier but Node.js._
d3c8a1a8 794
3a4b605f 795#### Public property replacements
5c5a1fb7 796
3a4b605f 797`numWorkers` property is now `numberOfWorkers`
5c5a1fb7 798
280c2a77 799#### Internal (protected) properties and methods renaming
fa0f5b28 800
280c2a77
S
801These properties are not intended for end users
802
803- `id` => `nextMessageId`
804
805These methods are not intended for end users
fa0f5b28
S
806
807- `_chooseWorker` => `chooseWorker`
280c2a77 808- `_newWorker` => `createWorker`
fa0f5b28
S
809- `_execute` => `internalExecute`
810- `_chooseWorker` => `chooseWorker`
811- `_checkAlive` => `checkAlive`
812- `_run` => `run`
813- `_runAsync` => `runAsync`
814
90ee1b18 815## [1.1.0] - 2020-05-21
0312f71a
APA
816
817### Added
818
819- ThreadWorker support async functions as option
cf9aa6c3 820- Various external library patches
0312f71a 821
90ee1b18 822## [1.0.0] - 2020-01-24
522eea03 823
824### Added
825
826- FixedThreadPool implementation
827- DynamicThreadPool implementation
0312f71a 828- WorkerThread implementation to improve developer experience