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