First attempt at SSE backend #3

This commit is contained in:
Ian Renton
2025-12-22 12:04:35 +00:00
parent 968576f74c
commit c95c6bb347
7 changed files with 427 additions and 148 deletions

View File

@@ -3,6 +3,7 @@ from datetime import datetime
import pytz
from core.config import MAX_ALERT_AGE
from spothole import add_alert
# Generic alert provider class. Subclasses of this query the individual APIs for alerts.
@@ -29,11 +30,9 @@ class AlertProvider:
# to deal with duplicates.
def submit_batch(self, alerts):
for alert in alerts:
# Fill in any blanks
# Fill in any blanks and add to the list
alert.infer_missing()
# Add to the list, provided it heas not already expired.
if not alert.expired():
self.alerts.add(alert.id, alert, expire=MAX_ALERT_AGE)
add_alert(alert)
# Stop any threads and prepare for application shutdown
def stop(self):