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