@canonry/canonry 4.148.7 → 4.148.8
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/{chunk-4VNOYFCG.js → chunk-LAJQRA4E.js} +54 -36
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +9 -9
|
@@ -5609,6 +5609,7 @@ async function parseSitemapRecursive(url, urls, visited, depth, isChild) {
|
|
|
5609
5609
|
|
|
5610
5610
|
// src/gsc-inspect-paced.ts
|
|
5611
5611
|
var INSPECT_BASE_DELAY_MS = 1e3;
|
|
5612
|
+
var INSPECT_MAX_CONCURRENCY = 5;
|
|
5612
5613
|
var INSPECT_PACING_JITTER_MS = 250;
|
|
5613
5614
|
var INSPECT_MAX_RETRIES = 3;
|
|
5614
5615
|
var INSPECT_MAX_BACKOFF_MS = 3e4;
|
|
@@ -5625,49 +5626,66 @@ function defaultSleep(ms) {
|
|
|
5625
5626
|
async function inspectUrlsPaced(urls, cb, deps = {}) {
|
|
5626
5627
|
const sleep3 = deps.sleep ?? defaultSleep;
|
|
5627
5628
|
const jitter = deps.jitter ?? Math.random;
|
|
5629
|
+
const concurrency = Math.max(1, Math.min(deps.concurrency ?? INSPECT_MAX_CONCURRENCY, urls.length || 1));
|
|
5628
5630
|
let inspected = 0;
|
|
5629
5631
|
let errors = 0;
|
|
5630
5632
|
let consecutiveRetryableFailures = 0;
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5633
|
+
let nextIndex = 0;
|
|
5634
|
+
let aborted = false;
|
|
5635
|
+
let abortError;
|
|
5636
|
+
let ratePromise = Promise.resolve();
|
|
5637
|
+
const takeRateSlot = () => {
|
|
5638
|
+
const wait = ratePromise.then(() => sleep3(INSPECT_BASE_DELAY_MS + jitter() * INSPECT_PACING_JITTER_MS));
|
|
5639
|
+
ratePromise = wait;
|
|
5640
|
+
return wait;
|
|
5641
|
+
};
|
|
5642
|
+
async function worker() {
|
|
5643
|
+
for (; ; ) {
|
|
5644
|
+
if (aborted) return;
|
|
5645
|
+
const index = nextIndex++;
|
|
5646
|
+
if (index >= urls.length) return;
|
|
5647
|
+
const url = urls[index];
|
|
5648
|
+
if (index > 0) await takeRateSlot();
|
|
5649
|
+
if (aborted) return;
|
|
5650
|
+
try {
|
|
5651
|
+
const result = await withRetry(() => cb.inspectOne(url), {
|
|
5652
|
+
maxRetries: INSPECT_MAX_RETRIES,
|
|
5653
|
+
baseDelayMs: INSPECT_BASE_DELAY_MS,
|
|
5654
|
+
maxDelayMs: INSPECT_MAX_BACKOFF_MS,
|
|
5655
|
+
isRetryable: isRetryableGscInspectError,
|
|
5656
|
+
sleep: sleep3,
|
|
5657
|
+
onRetry: ({ attempt, delayMs, err }) => deps.log?.info("inspect.retry", {
|
|
5658
|
+
url,
|
|
5659
|
+
attempt,
|
|
5660
|
+
delayMs: Math.round(delayMs),
|
|
5661
|
+
error: err instanceof Error ? err.message : String(err)
|
|
5662
|
+
})
|
|
5663
|
+
});
|
|
5664
|
+
cb.onResult(url, result, index);
|
|
5665
|
+
inspected++;
|
|
5666
|
+
consecutiveRetryableFailures = 0;
|
|
5667
|
+
} catch (err) {
|
|
5668
|
+
errors++;
|
|
5669
|
+
cb.onError(url, err, index);
|
|
5670
|
+
if (isRetryableGscInspectError(err)) {
|
|
5671
|
+
consecutiveRetryableFailures++;
|
|
5672
|
+
if (consecutiveRetryableFailures >= INSPECT_FAILFAST_THRESHOLD) {
|
|
5673
|
+
deps.log?.error("inspect.circuit-break", {
|
|
5674
|
+
consecutiveFailures: consecutiveRetryableFailures,
|
|
5675
|
+
inspected,
|
|
5676
|
+
errors,
|
|
5677
|
+
remaining: urls.length - nextIndex
|
|
5678
|
+
});
|
|
5679
|
+
aborted = true;
|
|
5680
|
+
abortError = err;
|
|
5681
|
+
return;
|
|
5682
|
+
}
|
|
5663
5683
|
}
|
|
5664
5684
|
}
|
|
5665
5685
|
}
|
|
5666
|
-
if (index < urls.length - 1) {
|
|
5667
|
-
await sleep3(INSPECT_BASE_DELAY_MS + jitter() * INSPECT_PACING_JITTER_MS);
|
|
5668
|
-
}
|
|
5669
5686
|
}
|
|
5670
|
-
|
|
5687
|
+
await Promise.all(Array.from({ length: concurrency }, () => worker()));
|
|
5688
|
+
return aborted ? { inspected, errors, aborted: true, abortError } : { inspected, errors, aborted: false };
|
|
5671
5689
|
}
|
|
5672
5690
|
|
|
5673
5691
|
// src/gsc-inspect-sitemap.ts
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonry/canonry",
|
|
3
|
-
"version": "4.148.
|
|
3
|
+
"version": "4.148.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Agent-first open-source AEO operating platform - track how answer engines cite your domain",
|
|
6
6
|
"license": "FSL-1.1-ALv2",
|
|
@@ -67,25 +67,25 @@
|
|
|
67
67
|
"tsup": "^8.5.1",
|
|
68
68
|
"tsx": "^4.19.0",
|
|
69
69
|
"@ainyc/canonry-api-client": "0.0.0",
|
|
70
|
-
"@ainyc/canonry-config": "0.0.0",
|
|
71
|
-
"@ainyc/canonry-contracts": "0.0.0",
|
|
72
70
|
"@ainyc/canonry-api-routes": "0.0.0",
|
|
71
|
+
"@ainyc/canonry-contracts": "0.0.0",
|
|
72
|
+
"@ainyc/canonry-config": "0.0.0",
|
|
73
73
|
"@ainyc/canonry-db": "0.0.0",
|
|
74
74
|
"@ainyc/canonry-integration-bing": "0.0.0",
|
|
75
|
-
"@ainyc/canonry-integration-
|
|
75
|
+
"@ainyc/canonry-integration-cloud-run": "0.0.0",
|
|
76
|
+
"@ainyc/canonry-integration-google": "0.0.0",
|
|
76
77
|
"@ainyc/canonry-integration-commoncrawl": "0.0.0",
|
|
77
|
-
"@ainyc/canonry-integration-google-places": "0.0.0",
|
|
78
78
|
"@ainyc/canonry-integration-google-business-profile": "0.0.0",
|
|
79
|
-
"@ainyc/canonry-integration-google": "0.0.0",
|
|
80
|
-
"@ainyc/canonry-integration-cloud-run": "0.0.0",
|
|
79
|
+
"@ainyc/canonry-integration-google-places": "0.0.0",
|
|
81
80
|
"@ainyc/canonry-integration-traffic": "0.0.0",
|
|
82
|
-
"@ainyc/canonry-integration-wordpress": "0.0.0",
|
|
83
81
|
"@ainyc/canonry-intelligence": "0.0.0",
|
|
82
|
+
"@ainyc/canonry-provider-cdp": "0.0.0",
|
|
83
|
+
"@ainyc/canonry-integration-wordpress": "0.0.0",
|
|
84
84
|
"@ainyc/canonry-provider-claude": "0.0.0",
|
|
85
|
+
"@ainyc/canonry-integration-openai-ads": "0.0.0",
|
|
85
86
|
"@ainyc/canonry-provider-gemini": "0.0.0",
|
|
86
87
|
"@ainyc/canonry-provider-local": "0.0.0",
|
|
87
88
|
"@ainyc/canonry-provider-openai": "0.0.0",
|
|
88
|
-
"@ainyc/canonry-provider-cdp": "0.0.0",
|
|
89
89
|
"@ainyc/canonry-provider-perplexity": "0.0.0"
|
|
90
90
|
},
|
|
91
91
|
"scripts": {
|