chore: generate documentation
[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
2431bdb4
JB
10### Fixed
11
12- Ensure workers are not recreated on error at pool startup.
13
14### Added
15
16- Add `ready` and `strategy` fields to pool information.
17- Add pool event `ready` to notify when the number of workers created in the pool has reached the maximum size expected and are ready.
18- Add dynamic pool sizes checks.
19
369d0a51
JB
20## [2.6.9] - 2023-07-07
21
2845f2a5
JB
22### Fixed
23
24- Recreate the right worker type on uncaught exception.
25
26### Added
27
28- Add minimum and maximum to internal measurement statistics.
1dcf8b7b 29- Add `runTime` and `waitTime` to pool information.
75d3401a 30- Check worker inactive time only on dynamic worker.
2845f2a5 31
fc97d613
JB
32## [2.6.8] - 2023-07-03
33
92b1feaa
JB
34### Fixed
35
36- Brown paper bag release to fix version handling in pool information.
37
52d54060
JB
38## [2.6.7] - 2023-07-03
39
5bc91f3e
JB
40### Fixed
41
42- Ensure worker queued tasks at error are reassigned to other pool workers.
43
afe0d5bf
JB
44### Added
45
46- Add pool `utilization` ratio to pool information.
23ccf9d7 47- Add `version` to pool information.
e5b3047d 48- Add worker information to worker nodes.
afe0d5bf 49
f42c583f
JB
50## [2.6.6] - 2023-07-01
51
6961ca9a
JB
52### Added
53
54- Add safe helper `availableParallelism` to help sizing the pool.
55
3749facb
JB
56### Fixed
57
58- Ensure message handler is only registered in worker.
59
6fed2513
JB
60## [2.6.5] - 2023-06-27
61
c72f6987
JB
62### Known issues
63
70726c28 64- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
c72f6987
JB
65
66### Fixed
67
68- Artificial version bump to 2.6.5 to workaround publication issue.
69- Ensure cluster pool destroy() gracefully shutdowns worker's server.
70- Ensure pool event is emitted before task error promise rejection.
71- Fix queued tasks count computation.
72
73### Removed
74
75- Remove unneeded worker-threads worker `MessageChannel` internal usage for IPC.
76
6426631b
JB
77## [2.6.4] - 2023-06-27
78
941f9a7c
JB
79### Known issues
80
70726c28 81- Cluster pools tasks execution are not working by using ESM files extension: https://github.com/poolifier/poolifier/issues/782
941f9a7c 82
2c039e43
JB
83### Fixed
84
85- Ensure cluster pool destroy() gracefully shutdowns worker's server.
86- Ensure pool event is emitted before task error promise rejection.
9c16fb4b 87- Fix queued tasks count computation.
2c039e43 88
941f9a7c
JB
89### Removed
90
91- Remove unneeded worker-threads worker `MessageChannel` internal usage for IPC.
92
bc1b0765
JB
93## [2.6.3] - 2023-06-19
94
a6a2dc4c
JB
95### Fixed
96
97- Ensure no tasks are queued when trying to soft kill a dynamic worker.
f0d7f803 98- Update strategies internals after statistics computation.
a6a2dc4c 99
7b56f532
JB
100### Changed
101
102- Optimize O(1) queue implementation.
103
b628596c
JB
104## [2.6.2] - 2023-06-12
105
a9e89d00
JB
106### Fixed
107
108- Fix new worker use after creation in dynamic pool given the current worker choice strategy.
109
4368a898
JB
110## [2.6.1] - 2023-06-10
111
931d43e2
JB
112### Added
113
114- Add worker choice strategy documentation: [README.md](./src/pools/selection-strategies/README.md).
115
f1c06930
JB
116### Fixed
117
118- Fix average statistics computation: ensure failed tasks are not accounted.
119
16671b07
JB
120## [2.6.0] - 2023-06-09
121
a1347286
JB
122### Added
123
5af9c0f7 124- Add `LEAST_ELU` worker choice strategy (experimental).
9adcefab 125- Add tasks ELU instead of runtime support to `FAIR_SHARE` worker choice strategy.
a1347286 126
1c6fe997
JB
127### Changed
128
129- Refactor pool worker node usage internals.
477f48e7 130- Breaking change: refactor worker choice strategy statistics requirements: the syntax of the worker choice strategy options has changed.
f63a9dda 131- Breaking change: pool information `info` property object fields have been renamed.
1c6fe997
JB
132
133### Fixed
134
135- Fix wait time accounting.
136- Ensure worker choice strategy `LEAST_BUSY` accounts also tasks wait time.
137- Ensure worker choice strategy `LEAST_USED` accounts also queued tasks.
138
aa07d6ee
JB
139## [2.5.4] - 2023-06-07
140
b6b32453
JB
141### Added
142
143- Add Event Loop Utilization (ELU) statistics to worker tasks usage.
144
145### Changed
146
147- Compute statistics at the worker level only if needed.
90082c8c 148- Add `worker-threads` options to thread pool options.
b6b32453 149
272d4d8f
JB
150### Fixed
151
152- Make the `LEAST_BUSY` strategy only relies on task runtime.
153
ed47fb3d
JB
154## [2.5.3] - 2023-06-04
155
89a4abfd
JB
156### Changed
157
158- Refine pool information content.
b4213b7f 159- Limit pool internals public exposure.
89a4abfd 160
8a9febf5
JB
161## [2.5.2] - 2023-06-02
162
91ee39ed
JB
163### Added
164
165- Add `taskError` pool event for task execution error.
6b27d407 166- Add pool information `info` property to pool.
91ee39ed
JB
167- Emit pool information on `busy` and `full` pool events.
168
8babb151
JB
169## [2.5.1] - 2023-06-01
170
0e05c4dc
JB
171### Added
172
1f68cede 173- Add pool option `restartWorkerOnError` to restart worker on uncaught error. Default to `true`.
91ee39ed 174- Add `error` pool event for uncaught worker error.
0e05c4dc 175
a8766181
JB
176## [2.5.0] - 2023-05-31
177
e4543b14
JB
178### Added
179
180- Switch pool event emitter to `EventEmitterAsyncResource`.
6da80d38 181- Add tasks wait time accounting in per worker tasks usage.
5af9c0f7 182- Add interleaved weighted round robin `INTERLEAVED_WEIGHTED_ROUND_ROBIN` worker choice strategy (experimental).
e4543b14
JB
183
184### Changed
185
186- Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`.
187
570efb11
JB
188## [2.4.14] - 2023-05-09
189
b0f28bad
JB
190### Fixed
191
192- Ensure no undefined task runtime can land in the tasks history.
193- Fix median computation implementation once again.
194
110b6d13
JB
195### Added
196
197- Unit tests for median and queue implementations.
198
72584880
JB
199## [2.4.13] - 2023-05-08
200
b0d6ed8f
JB
201### Fixed
202
e3058615 203- Fix worker choice strategy options validation.
b0d6ed8f
JB
204- Fix fair share worker choice strategy internals update: ensure virtual task end timestamp is computed at task submission.
205
06140c32
JB
206## [2.4.12] - 2023-05-06
207
a86b6df1
JB
208### Added
209
210- Support multiple task functions per worker.
08f3f44c 211- Add custom worker weights support to worker choice strategies options.
a86b6df1 212
29ee7e9a
JB
213### Changed
214
215- Use O(1) queue implementation for tasks queueing.
216
0682ba15
JB
217### Fixed
218
219- Fix median computation implementation.
220- Fix fair share worker choice strategy internals update.
221
936d53ec
JB
222## [2.4.11] - 2023-04-23
223
cb70b19d
JB
224### Changed
225
226- Optimize free worker finding in worker choice strategies.
227
15bb637a
JB
228## [2.4.10] - 2023-04-15
229
ef41a6e6
JB
230### Fixed
231
232- Fix typescript type definition for worker function: ensure the input data is optional.
233- Fix typescript type definition for pool execute(): ensure the input data is optional.
234
181eb2b4
JB
235## [2.4.9] - 2023-04-15
236
a20f0ba5
JB
237### Added
238
239- Add tasks queue enablement runtime setter to pool.
240- Add tasks queue options runtime setter to pool.
241- Add worker choice strategy options runtime setter to pool.
242
243### Changed
244
245- Remove the tasks queuing experimental status.
246
d4aeae5a
JB
247### Fixed
248
249- Fix worker function type definition and validation.
2fc5cae3 250- Fix worker choice strategy options handling.
d4aeae5a 251
1d9e7023
JB
252## [2.4.8] - 2023-04-12
253
f9b4bbf8
JB
254### Fixed
255
256- Fix message between main worker and worker type definition for tasks.
257- Fix code documentation.
258
12ae3210
JB
259## [2.4.7] - 2023-04-11
260
7171d33f
JB
261### Added
262
263- Add worker tasks queue options to pool options.
264
e8bd29ce
JB
265### Fixed
266
267- Fix missing documentation.
268
42c7bc10
JB
269## [2.4.6] - 2023-04-10
270
681196cc
JB
271### Fixed
272
273- Ensure one task at a time is executed per worker with tasks queueing enabled.
1c6fe997 274- Properly count worker executing tasks with tasks queueing enabled.
681196cc 275
54d360e3
JB
276## [2.4.5] - 2023-04-09
277
3fafb1b2
JB
278### Added
279
9e775f96
JB
280- Use monotonic high resolution timer for worker tasks runtime.
281- Add worker tasks median runtime to statistics.
ff733df7 282- Add worker tasks queue (experimental).
3fafb1b2 283
92fa3eb6
JB
284## [2.4.4] - 2023-04-07
285
aee46736
JB
286### Added
287
288- Add `PoolEvents` enumeration and `PoolEvent` type.
289
36b5e78f
JB
290### Fixed
291
ff0c2b3e 292- Destroy worker only on alive check.
36b5e78f 293
9fb0f324
JB
294## [2.4.3] - 2023-04-07
295
28cf3617
JB
296### Fixed
297
298- Fix typedoc generation with inheritance.
299
848f0f27
JB
300## [2.4.2] - 2023-04-06
301
164d950a
JB
302### Added
303
304- Add `full` event to dynamic pool.
32417142 305- Keep worker choice strategy in memory for conditional reuse.
164d950a 306
78ab2555
JB
307### Fixed
308
309- Fix possible negative worker key at worker removal in worker choice strategies.
310
79aafe9f
JB
311## [2.4.1] - 2023-04-05
312
9cd39dd4
JB
313### Changed
314
315- Optimize worker choice strategy for dynamic pool.
316
965415bb
JB
317### Fixed
318
319- Ensure dynamic pool does not alter worker choice strategy expected behavior.
320
d8b60b1c
JB
321## [2.4.0] - 2023-04-04
322
c6bd2650
JB
323### Added
324
325- Add `LESS_BUSY` worker choice strategy.
326
327### Changed
328
329- Optimize worker storage in pool.
330- Optimize worker alive status check.
331- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
332- Optimize `LESS_USED` worker choice strategy.
333- Update benchmarks versus external threads pools.
334- Optimize tasks usage statistics requirements for worker choice strategy.
335
336### Fixed
337
338- Ensure trimmable characters are checked at pool initialization.
339- Fix message id integer overflow.
340- Fix pool worker removal in worker choice strategy internals.
341- Fix package publication with pnpm.
342
d0a3f018
JB
343## [2.4.0-3] - 2023-04-04
344
b2ede285
JB
345### Added
346
347- Add `LESS_BUSY` worker choice strategy.
348
349### Changed
350
351- Optimize worker storage in pool.
352- Optimize worker alive status check.
353- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
354- Optimize `LESS_USED` worker choice strategy.
355- Update benchmarks versus external threads pools.
356
357### Fixed
358
359- Ensure trimmable characters are checked at pool initialization.
360- Fix message id integer overflow.
361- Fix pool worker removal in worker choice strategy internals.
362- Fix package publication with pnpm.
363
a015ea40
JB
364## [2.4.0-2] - 2023-04-03
365
698f4bbc
JB
366### Added
367
368- Add `LESS_BUSY` worker choice strategy.
369
370### Changed
371
372- Optimize worker storage in pool.
373- Optimize worker alive status check.
374- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
375- Optimize `LESS_USED` worker choice strategy.
376
377### Fixed
378
379- Ensure trimmable characters are checked at pool initialization.
380- Fix message id integer overflow.
381- Fix pool worker removal in worker choice strategy internals.
382- Fix package publication with pnpm.
383
8fe15920
JB
384## [2.4.0-1] - 2023-04-03
385
5b301c28
JB
386### Added
387
388- Add `LESS_BUSY` worker choice strategy.
389
390### Changed
391
392- Optimize worker storage in pool.
393- Optimize worker alive status check.
394- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
395- Optimize `LESS_USED` worker choice strategy.
396
397### Fixed
398
399- Ensure trimmable characters are checked at pool initialization.
400- Fix message id integer overflow.
401- Fix pool worker removal in worker choice strategy internals.
402
2fb9ca9c
JB
403## [2.4.0-0] - 2023-04-03
404
168c526f
JB
405### Added
406
407- Add `LESS_BUSY` worker choice strategy.
408
1d71a908
JB
409### Changed
410
ffcbbad8 411- Optimize worker storage in pool.
1d71a908 412- Optimize worker alive status check.
65a60b3b 413- BREAKING CHANGE: Rename worker choice strategy `LESS_RECENTLY_USED` to `LESS_USED`.
737c6d97 414- Optimize `LESS_USED` worker choice strategy.
1d71a908 415
ffcbbad8
JB
416### Fixed
417
418- Ensure trimmable characters are checked at pool initialization.
b4e75778 419- Fix message id integer overflow.
97a2abc3 420- Fix pool worker removal in worker choice strategy internals.
ffcbbad8 421
08372738
JB
422## [2.3.10] - 2023-03-18
423
710826bc
JB
424### Fixed
425
426- Fix `exports` syntax for ESM and CommonJS.
427
428### Changed
429
430- Permit SemVer pre-release publication.
76e5ac6f 431
e4796ecd
JB
432## [2.3.10-2] - 2023-03-18
433
6abad580
JB
434### Fixed
435
436- Fix `exports` syntax for ESM and CommonJS.
437
a2ee98cc
JB
438## [2.3.10-1] - 2023-03-18
439
7e060cee
JB
440### Changed
441
90483887 442- Permit SemVer pre-release publication.
7e060cee 443
c81bfafb
JB
444## [2.3.10-0] - 2023-03-18
445
fe18768d
JB
446### Fixed
447
448- Fix `exports` syntax for ESM and CommonJS.
449
d7b78217
JB
450## [2.3.9] - 2023-03-18
451
ed6dd37f
JB
452### Changed
453
454- Introduce ESM module support along with CommonJS one.
455
456### Fixed
457
458- Fix brown paper bag bug referencing the same object literal.
459
68e2ad86
JB
460## [2.3.8] - 2023-03-18
461
ca6c7d70
JB
462### Changed
463
464- Switch internal benchmarking code to benny.
fbdedeb9
JB
465- Switch to TypeScript 5.x.x.
466- Switch rollup bundler plugins to core ones.
ed6dd37f 467- Switch to TSDoc syntax.
fbdedeb9 468- Enforce conventional commits.
ca6c7d70 469
d15211d4
JB
470### Fixed
471
472- Fix random integer generator.
fbdedeb9 473- Fix worker choice strategy pool type identification at initialization.
d15211d4 474
995705ea
JB
475## [2.3.7] - 2022-10-23
476
b953022b
JB
477### Changed
478
479- Switch to open collective FOSS project funding platform.
78cea37e
JB
480- Switch to ts-standard linter configuration on TypeScript code.
481
482### Fixed
483
484- Fixed missing async on pool execute method.
485- Fixed typing in TypeScript example.
486- Fixed types in unit tests.
b953022b 487
3b9f6953
JB
488## [2.3.6] - 2022-10-22
489
f80cead4
JB
490### Changed
491
492- Cleanup pool attributes and methods.
493- Refine error types thrown.
494
495### Fixed
496
497- Fix continuous integration build on windows.
498- Fix code coverage reporting by using c8 instead of nyc.
499
efc22107
JB
500## [2.3.5] - 2022-10-21
501
7a6a0a96
JB
502### Changed
503
a05c10de
JB
504- Improve benchmarks: add IO intensive task workload, add task size option, integrate code into linter.
505- Optimize tasks usage lookup implementation.
7a6a0a96 506
b4904890
JB
507### Fixed
508
509- Fix missed pool event emitter type export.
510- Fix typedoc documentation generation.
511
a875f8d1
JB
512## [2.3.4] - 2022-10-17
513
73cda448
JB
514### Added
515
516- Fully automate release process with release-it.
517
45a5a54c
JB
518### Changed
519
73cda448 520- Optimize fair share task scheduling algorithm implementation.
eb4a8a82 521- Update benchmarks versus external pools results with latest version.
45a5a54c 522
90ee1b18 523## [2.3.3] - 2022-10-15
1a76932b
JB
524
525### Added
526
527- Add support for [cluster settings](https://nodejs.org/api/cluster.html#cluster_cluster_settings) in cluster pool options.
528
90ee1b18 529## [2.3.2] - 2022-10-14
11df3590
JB
530
531### Changed
532
533- Optimize fair share worker selection strategy implementation.
534
535### Fixed
536
537- Fix WRR worker selection strategy: ensure the condition triggering the round robin can be fulfilled.
538
90ee1b18 539## [2.3.1] - 2022-10-13
23ff945a
JB
540
541### Added
542
543- Pool worker choice strategies:
544 - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN` strategy based on weighted round robin scheduling algorithm using tasks execution time for now.
545 - `WorkerChoiceStrategies.FAIR_SHARE` strategy based on fair share scheduling algorithm using tasks execution time for now.
546
90ee1b18 547## [2.2.2] - 2022-10-09
cb2b6c69
JB
548
549### Fixed
550
551- Fixed `README.md` file.
552
90ee1b18 553## [2.2.1] - 2022-10-08
bdacc2d2 554
bdaf31cd
JB
555### Added
556
557- Dynamic worker choice strategy change at runtime.
bdacc2d2 558
90ee1b18 559## [2.2.0] - 2022-01-05
7e0d447f
JB
560
561### Breaking Changes
562
563- Support only NodeJS version 16.x.x for cluster pool: upstream cluster API have changed on that version.
564
90ee1b18 565## [2.1.0] - 2021-08-29
35cf1c03
JB
566
567### Added
568
569- Add an optional pool option `messageHandler` to `PoolOptions<Worker>` for registering a message handler callback on each worker.
e088a00c
JB
570
571### Breaking Changes
572
573- `AbstractWorker` class `maxInactiveTime`, `killBehavior` and `async` attributes have been removed in favour of the same ones in the worker options `opts` public attribute.
574- `AbstractWorker` class `lastTask` attribute have been renamed to `lastTaskTimestamp`.
575- `AbstractWorker` class `interval` attribute have been renamed to `aliveInterval`.
c365b2d3 576- `AbstractWorker` class cannot be instantiated without specifying the `mainWorker` argument referencing the main worker.
e088a00c 577
90ee1b18 578## [2.0.2] - 2021-05-12
14916bf9
JB
579
580### Bug fixes
581
582- Fix `busy` event emission on fixed pool type
583
90ee1b18 584## [2.0.1] - 2021-03-16
7f685093
JB
585
586### Bug fixes
587
588- Check if pool options are properly set.
589- `busy` event is emitted on all pool types.
590
90ee1b18 591## [2.0.0] - 2021-03-01
fa0f5b28 592
f3f833ab 593### Bug fixes
d63d3be3 594
ddbeaffd 595- Now a thread/process by default is not deleted when the task submitted take more time than maxInactiveTime configured (issue #70).
d63d3be3 596
fa0f5b28
S
597### Breaking Changes
598
7f685093 599- `FullPool` event is now renamed to `busy`.
1927ee67 600- `maxInactiveTime` on `ThreadWorker` default behavior is now changed, if you want to keep the old behavior set `killBehavior` to `KillBehaviors.HARD`.
1a81f8af 601 _Find more details on our JSDoc._
ddbeaffd 602
1927ee67
APA
603- `maxTasks` option on `FixedThreadPool` and `DynamicThreadPool` is now removed since is no more needed.
604
ddbeaffd 605- We changed some internal structures, but you shouldn't be too affected by them as these are internal changes.
fa0f5b28 606
ec2ccfc8
JB
607### Pool options types declaration merge
608
609`FixedThreadPoolOptions` and `DynamicThreadPoolOptions` type declarations have been merged to `PoolOptions<Worker>`.
610
fa0f5b28
S
611#### New `export` strategy
612
613```js
614// Before
777b7824 615const DynamicThreadPool = require('poolifier/lib/dynamic')
fa0f5b28 616// After
777b7824 617const { DynamicThreadPool } = require('poolifier/lib/dynamic')
fa0f5b28
S
618```
619
620But you should always prefer just using
621
622```js
777b7824 623const { DynamicThreadPool } = require('poolifier')
fa0f5b28
S
624```
625
d3c8a1a8
S
626#### New type definitions for input data and response
627
6677a3d3 628For cluster worker and worker-thread pools, you can now only send and receive structured-cloneable data.
d3c8a1a8
S
629_This is not a limitation by poolifier but NodeJS._
630
3a4b605f 631#### Public property replacements
5c5a1fb7 632
3a4b605f 633`numWorkers` property is now `numberOfWorkers`
5c5a1fb7 634
280c2a77 635#### Internal (protected) properties and methods renaming
fa0f5b28 636
280c2a77
S
637These properties are not intended for end users
638
639- `id` => `nextMessageId`
640
641These methods are not intended for end users
fa0f5b28
S
642
643- `_chooseWorker` => `chooseWorker`
280c2a77 644- `_newWorker` => `createWorker`
fa0f5b28
S
645- `_execute` => `internalExecute`
646- `_chooseWorker` => `chooseWorker`
647- `_checkAlive` => `checkAlive`
648- `_run` => `run`
649- `_runAsync` => `runAsync`
650
90ee1b18 651## [1.1.0] - 2020-05-21
0312f71a
APA
652
653### Added
654
655- ThreadWorker support async functions as option
cf9aa6c3 656- Various external library patches
0312f71a 657
90ee1b18 658## [1.0.0] - 2020-01-24
522eea03 659
660### Added
661
662- FixedThreadPool implementation
663- DynamicThreadPool implementation
0312f71a 664- WorkerThread implementation to improve developer experience