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