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