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