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