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:
@@ -26,7 +26,6 @@ cleanup_timer = None
|
|||||||
|
|
||||||
# Shutdown function
|
# Shutdown function
|
||||||
def shutdown(sig, frame):
|
def shutdown(sig, frame):
|
||||||
global spot_providers, alert_providers, cleanup_timer, spots, alerts
|
|
||||||
logging.info("Stopping program, this may take a few seconds...")
|
logging.info("Stopping program, this may take a few seconds...")
|
||||||
for p in spot_providers:
|
for p in spot_providers:
|
||||||
if p.enabled:
|
if p.enabled:
|
||||||
@@ -56,7 +55,6 @@ def get_alert_provider_from_config(config_providers_entry):
|
|||||||
# Utility method to add a spot, notifying the web server in case any Server-Sent Event connections need to have data
|
# Utility method to add a spot, notifying the web server in case any Server-Sent Event connections need to have data
|
||||||
# sent immediately. If the spot has already expired due to loading old data, it will be ignored.
|
# sent immediately. If the spot has already expired due to loading old data, it will be ignored.
|
||||||
def add_spot(spot):
|
def add_spot(spot):
|
||||||
global web_server
|
|
||||||
if not spot.expired():
|
if not spot.expired():
|
||||||
spots.add(spot.id, spot, expire=MAX_SPOT_AGE)
|
spots.add(spot.id, spot, expire=MAX_SPOT_AGE)
|
||||||
if web_server:
|
if web_server:
|
||||||
@@ -65,7 +63,6 @@ def add_spot(spot):
|
|||||||
# Utility method to add an alert, notifying the web server in case any Server-Sent Event connections need to have data
|
# Utility method to add an alert, notifying the web server in case any Server-Sent Event connections need to have data
|
||||||
# sent immediately. If the alert has already expired due to loading old data, it will be ignored.
|
# sent immediately. If the alert has already expired due to loading old data, it will be ignored.
|
||||||
def add_alert(alert):
|
def add_alert(alert):
|
||||||
global web_server
|
|
||||||
if not alert.expired():
|
if not alert.expired():
|
||||||
alerts.add(alert.id, alert, expire=MAX_SPOT_AGE)
|
alerts.add(alert.id, alert, expire=MAX_SPOT_AGE)
|
||||||
if web_server:
|
if web_server:
|
||||||
|
|||||||
Reference in New Issue
Block a user