@j0hanz/fetch-url-mcp 1.10.20 → 1.10.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/http/auth.d.ts +2 -0
- package/dist/http/auth.d.ts.map +1 -1
- package/dist/http/auth.js +30 -0
- package/dist/lib/core.d.ts +1 -1
- package/dist/lib/core.d.ts.map +1 -1
- package/dist/lib/core.js +44 -28
- package/dist/lib/dom-prep.d.ts +2 -0
- package/dist/lib/dom-prep.d.ts.map +1 -1
- package/dist/lib/dom-prep.js +68 -23
- package/dist/lib/http.d.ts.map +1 -1
- package/dist/lib/http.js +84 -55
- package/dist/lib/sdk-interop.d.ts +12 -0
- package/dist/lib/sdk-interop.d.ts.map +1 -1
- package/dist/lib/sdk-interop.js +12 -0
- package/dist/lib/session.d.ts +4 -1
- package/dist/lib/session.d.ts.map +1 -1
- package/dist/lib/session.js +1 -1
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +5 -0
- package/dist/resources/index.js +2 -2
- package/dist/schemas.js +1 -1
- package/dist/transform/html-translators.d.ts.map +1 -1
- package/dist/transform/html-translators.js +50 -8
- package/dist/transform/markdown-cleanup.d.ts.map +1 -1
- package/dist/transform/markdown-cleanup.js +71 -63
- package/dist/transform/metadata.d.ts.map +1 -1
- package/dist/transform/metadata.js +2 -7
- package/dist/transform/title-policy.d.ts.map +1 -1
- package/dist/transform/title-policy.js +8 -12
- package/dist/transform/transform.d.ts.map +1 -1
- package/dist/transform/transform.js +118 -60
- package/dist/transform/worker-pool.d.ts +2 -0
- package/dist/transform/worker-pool.d.ts.map +1 -1
- package/dist/transform/worker-pool.js +38 -17
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-pool.d.ts","sourceRoot":"","sources":["../../src/transform/worker-pool.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,uBAAuB,EAKxB,MA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211
211
|
busyCount = 0;
|
|
212
|
+
draining = false;
|
|
213
|
+
restartBackoff = new Map();
|
|
212
214
|
constructor(size, timeoutMs) {
|
|
213
215
|
this.capacity =
|
|
214
216
|
size === 0
|
|
@@ -418,6 +420,18 @@ class WorkerPool {
|
|
|
418
420
|
if (target) {
|
|
419
421
|
target.worker.terminate().catch(() => undefined);
|
|
420
422
|
}
|
|
423
|
+
const attempts = this.restartBackoff.get(workerIndex) ?? 0;
|
|
424
|
+
this.restartBackoff.set(workerIndex, attempts + 1);
|
|
425
|
+
if (attempts > 0) {
|
|
426
|
+
const delayMs = Math.min(1000 * 2 ** (attempts - 1), 30_000);
|
|
427
|
+
setTimeout(() => {
|
|
428
|
+
if (this.closed)
|
|
429
|
+
return;
|
|
430
|
+
this.workers[workerIndex] = this.spawnWorker(workerIndex);
|
|
431
|
+
this.drainQueue();
|
|
432
|
+
}, delayMs).unref();
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
421
435
|
this.workers[workerIndex] = this.spawnWorker(workerIndex);
|
|
422
436
|
this.drainQueue();
|
|
423
437
|
}
|
|
@@ -440,6 +454,7 @@ class WorkerPool {
|
|
|
440
454
|
const inflight = this.takeInflight(message.id);
|
|
441
455
|
if (!inflight)
|
|
442
456
|
return;
|
|
457
|
+
this.restartBackoff.delete(workerIndex);
|
|
443
458
|
this.markIdle(workerIndex);
|
|
444
459
|
this.resolveWorkerResult(inflight, message);
|
|
445
460
|
this.drainQueue();
|
|
@@ -500,28 +515,34 @@ class WorkerPool {
|
|
|
500
515
|
}
|
|
501
516
|
}
|
|
502
517
|
drainQueue() {
|
|
503
|
-
if (this.closed || this.queue.depth === 0)
|
|
518
|
+
if (this.closed || this.queue.depth === 0 || this.draining)
|
|
504
519
|
return;
|
|
505
|
-
this.
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
this.
|
|
510
|
-
if (
|
|
511
|
-
|
|
520
|
+
this.draining = true;
|
|
521
|
+
try {
|
|
522
|
+
this.maybeScaleUp();
|
|
523
|
+
for (let i = 0; i < this.workers.length; i += 1) {
|
|
524
|
+
const slot = this.workers[i];
|
|
525
|
+
if (slot && !slot.busy) {
|
|
526
|
+
this.dispatchFromQueue(i, slot);
|
|
527
|
+
if (this.queue.depth === 0)
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
512
530
|
}
|
|
513
|
-
}
|
|
514
|
-
if (this.workers.length < this.capacity && this.queue.depth > 0) {
|
|
515
|
-
const workerIndex = this.workers.length;
|
|
516
|
-
const slot = this.spawnWorker(workerIndex);
|
|
517
|
-
this.workers.push(slot);
|
|
518
|
-
this.dispatchFromQueue(workerIndex, slot);
|
|
519
531
|
if (this.workers.length < this.capacity && this.queue.depth > 0) {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
532
|
+
const workerIndex = this.workers.length;
|
|
533
|
+
const slot = this.spawnWorker(workerIndex);
|
|
534
|
+
this.workers.push(slot);
|
|
535
|
+
this.dispatchFromQueue(workerIndex, slot);
|
|
536
|
+
if (this.workers.length < this.capacity && this.queue.depth > 0) {
|
|
537
|
+
setImmediate(() => {
|
|
538
|
+
this.drainQueue();
|
|
539
|
+
});
|
|
540
|
+
}
|
|
523
541
|
}
|
|
524
542
|
}
|
|
543
|
+
finally {
|
|
544
|
+
this.draining = false;
|
|
545
|
+
}
|
|
525
546
|
}
|
|
526
547
|
dispatchFromQueue(workerIndex, slot) {
|
|
527
548
|
let task = this.queue.dequeue();
|
package/package.json
CHANGED