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