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