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