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