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