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