← back to Designer Wallcoverings
Harden Tres Tintas spec recrawl: retry+try/catch on vendor fetch
9f9be71a68fc3e4fcf96b28d0507df7787df597d · 2026-06-23 10:51:36 -0700 · Steve
Run crashed at product 54 on a transient vendor socket drop (UND_ERR_SOCKET
'other side closed') — no error handling meant one network blip killed the
whole run. Add fetchRetry (3 tries, backoff) for both vendor lookups, wrap
per-product fetch in try/catch so a failed product is skipped (NOT ledgered,
retried next run) instead of aborting. New netErr counter in summary.
Files touched
M shopify/scripts/tres-tintas-spec-recrawl.js
Diff
commit 9f9be71a68fc3e4fcf96b28d0507df7787df597d
Author: Steve <steve@designerwallcoverings.com>
Date: Tue Jun 23 10:51:36 2026 -0700
Harden Tres Tintas spec recrawl: retry+try/catch on vendor fetch
Run crashed at product 54 on a transient vendor socket drop (UND_ERR_SOCKET
'other side closed') — no error handling meant one network blip killed the
whole run. Add fetchRetry (3 tries, backoff) for both vendor lookups, wrap
per-product fetch in try/catch so a failed product is skipped (NOT ledgered,
retried next run) instead of aborting. New netErr counter in summary.
---
shopify/scripts/tres-tintas-spec-recrawl.js | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/shopify/scripts/tres-tintas-spec-recrawl.js b/shopify/scripts/tres-tintas-spec-recrawl.js
index 01b1c5e1..343d9ea0 100644
--- a/shopify/scripts/tres-tintas-spec-recrawl.js
+++ b/shopify/scripts/tres-tintas-spec-recrawl.js
@@ -176,7 +176,7 @@ async function main() {
pageInfo{ hasNextPage endCursor }
edges{ node{ id title tags } } } }`;
- let cursor = null, scanned = 0, processed = 0, filled = 0, noRef = 0, noVendor = 0;
+ let cursor = null, scanned = 0, processed = 0, filled = 0, noRef = 0, noVendor = 0, netErr = 0;
while (true) {
const conn = (await gql(q, { cursor })).products;
for (const e of conn.edges) {
@@ -190,11 +190,16 @@ async function main() {
if (processed >= LIMIT) continue;
if (!ref) { noRef++; continue; }
- const permalink = await vendorPermalink(ref); await sleep(120);
- if (!permalink) { console.log(` !! ${id} ${n.title} — no vendor page for ${ref}`); noVendor++; continue; }
-
- const html = await (await fetch(permalink, { headers: { 'User-Agent': UA } })).text();
- await sleep(120);
+ let permalink, html;
+ try {
+ permalink = await vendorPermalink(ref); await sleep(120);
+ if (!permalink) { console.log(` !! ${id} ${n.title} — no vendor page for ${ref}`); noVendor++; continue; }
+ html = await (await fetchRetry(permalink, { headers: { 'User-Agent': UA } })).text();
+ await sleep(120);
+ } catch (err) {
+ console.log(` !! ${id} ${n.title} [${ref}] — vendor fetch failed after retries: ${err.message} — SKIP (not ledgered, will retry next run)`);
+ netErr++; continue;
+ }
const vs = parseVendorSpecs(html);
const specs = mapSpecs(vs);
@@ -246,7 +251,7 @@ async function main() {
console.log(`\n--- SUMMARY ---`);
console.log(`scanned: ${scanned} | processed: ${processed} | filled-with-new-specs: ${filled}${APPLY ? '' : ' (dry run)'}`);
- console.log(`skipped: no-pattern-ref=${noRef} no-vendor-page=${noVendor}`);
+ console.log(`skipped: no-pattern-ref=${noRef} no-vendor-page=${noVendor} net-error(retry-next-run)=${netErr}`);
if (APPLY) console.log(`ledger -> ${LEDGER}`);
}
main().catch(e => { console.error(e); process.exit(1); });
← b7e3a00a auto-save: 2026-06-23T10:51:10 (5 files) — shopify/scripts/c
·
back to Designer Wallcoverings
·
PDP fix cluster: breadcrumbs grey-bar, Download PDF (inline 31f09baa →