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