mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-02-04 01:04:33 +00:00
First attempt at SSE backend #3
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user