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