@j0hanz/fetch-url-mcp 1.10.21 → 1.10.23
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 +88 -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/title-policy.d.ts +1 -3
- package/dist/transform/title-policy.d.ts.map +1 -1
- package/dist/transform/title-policy.js +3 -8
- package/dist/transform/transform.d.ts.map +1 -1
- package/dist/transform/transform.js +120 -64
- 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
|
@@ -209,6 +209,8 @@ class WorkerPool {
|
|
|
209
209
|
closed = false;
|
|
210
210
|
taskIdSeq = 0;
|
|
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