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