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