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