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