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