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