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