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