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