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