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