[object Object]

← back to La Socrata Ingester

contacts: per-row try/catch so one bad URL can't crash a shard worker

cefbc8e73c1cee9fd34ad522e8be7a6b65868e26 · 2026-08-12 09:57:15 -0700 · Steve Abrams

Files touched

Diff

commit cefbc8e73c1cee9fd34ad522e8be7a6b65868e26
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Aug 12 09:57:15 2026 -0700

    contacts: per-row try/catch so one bad URL can't crash a shard worker
---
 scripts/enrich-contacts.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/enrich-contacts.js b/scripts/enrich-contacts.js
index 03d941f..2c301b1 100644
--- a/scripts/enrich-contacts.js
+++ b/scripts/enrich-contacts.js
@@ -99,7 +99,12 @@ async function main() {
     const batch = await pick();
     if (!batch.length) { console.log(`\n✔ site-mining pass complete (${LA_ONLY ? 'LA' : 'all'} entities with a website)`); break; }
     for (const c of batch) {
-      const f = await enrichOne(c);
+      let f;
+      try { f = await enrichOne(c); }
+      catch (e) {                                     // one bad row must never kill the worker
+        try { await q(`UPDATE cslb_raw SET contacts_enriched_at=now() WHERE "LicenseNo"=$1`, [c.LicenseNo]); } catch {}
+        continue;
+      }
       done++; if (f.linkedin) li++; if (f.email) em++; if (f.phone) ph++;
       if (f.linkedin || f.email || f.phone)
         console.log(`  [${done}] ${(c.BusinessName || '').slice(0, 30).padEnd(30)} ${f.linkedin ? 'in✓' : '   '} ${f.email ? '@✓' : '  '} ${fmtPhone(f.phone)}`);

← 71dd4ab li-search: multi-source (cslb + rentv_licensed_targets) thro  ·  back to La Socrata Ingester  ·  li-search: multi-engine rotation + bing/mojeek (built; PAUSE 298f4ef →