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