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