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