fix: pipeline reliability — WS, summarizer, ingest, health

Stop the live HUD reconnect storm (nginx WS snippet + backoff), copy
intel/nous_client into the summarizer image, and make event ingest
idempotent on URL. GDELT uses the DOC API; NWS no longer sends bbox;
FIRMS is one ON CONFLICT batch; GET /api/aircraft serves last-known.
Health reports freshness without 503ing docker. EONET + CISA KEV added.
This commit is contained in:
Sirius DevOps 2026-08-28 21:49:05 -04:00
commit d81ea68dec
26 changed files with 1164 additions and 110 deletions

View file

@ -3,7 +3,7 @@
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import logging
import logging
import psycopg2
import os
from scrapy.exceptions import DropItem
@ -53,8 +53,10 @@ class PostgresPipeline:
self.connection.commit()
def process_item(self, item, spider):
if item ['url'] in self.seen_urls:
raise DropItem()
url = item['url']
if url in self.seen_urls:
raise DropItem(f"Duplicate URL (in-memory): {url}")
self.seen_urls.add(url)
try:
self.cur.execute("""
INSERT INTO articles (title, url, content, domain, timestamp)
@ -68,15 +70,16 @@ class PostgresPipeline:
item['timestamp']
))
if self.cur.rowcount == 0:
e = DropItem("Duplicate URL (database conflict)")
e.log_level = logging.DEBUG
raise e
raise DropItem(f"Duplicate URL (database): {url}")
self.connection.commit()
return item
return item
except DropItem:
self.connection.rollback()
raise
except Exception as e:
spider.logger.error(f"Error saving to Postgres: {e}")
self.connection.rollback()
raise
raise
def close_spider(self, spider):
self.cur.close()
@ -88,5 +91,3 @@ from itemadapter import ItemAdapter
class NewsscraperPipeline:
def process_item(self, item, spider):
return item