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