[object Object]

← back to Nationalrealestate

discover: mark run 'failed' when every firm errored (ok iff queried >=1) so assess() quarantines a truly-blocked job instead of masking it as ok

b56985520277243bbad5ebe74cb533082bb24ec1 · 2026-07-30 19:05:41 -0700 · steve@designerwallcoverings.com

Files touched

Diff

commit b56985520277243bbad5ebe74cb533082bb24ec1
Author: steve@designerwallcoverings.com <steve@designerwallcoverings.com>
Date:   Thu Jul 30 19:05:41 2026 -0700

    discover: mark run 'failed' when every firm errored (ok iff queried >=1) so assess() quarantines a truly-blocked job instead of masking it as ok
---
 src/enrich/firm_website_discovery.ts | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/enrich/firm_website_discovery.ts b/src/enrich/firm_website_discovery.ts
index c71e25c..c8d5bc3 100644
--- a/src/enrich/firm_website_discovery.ts
+++ b/src/enrich/firm_website_discovery.ts
@@ -219,9 +219,11 @@ async function main() {
     console.error(`[discover] loop aborted, recording partial: ${String(e?.message || e).slice(0, 120)}`);
   }
 
-  // Always close the run. 'ok' if it processed anything (partial anti-bot failures
-  // are normal for HTML search scraping); 'failed' only on a total pre-loop wipeout.
-  const status = (ok || miss || err) ? 'ok' : 'failed';
+  // Always close the run (no zombie 'running'). 'ok' if at least one firm was
+  // actually queried (found, or a legit no-result — the search WORKED); 'failed'
+  // if EVERY firm errored (fully throttled/blocked) so assess() backs off →
+  // quarantines it instead of us masking a broken job as healthy.
+  const status = (ok || miss) ? 'ok' : 'failed';
   await query(
     `UPDATE ingest_runs SET finished_at = NOW(), status = $5, rows_upserted = $2, rows_skipped = $3,
             notes = notes || $4 WHERE id = $1`,

← 0321546 discover: fail-soft run recording (try/catch closeRun) so se  ·  back to Nationalrealestate  ·  Add Places-API firm->website resolver (resolve:firms): relia 0846541 →