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