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