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