First attempt at SSE backend #3

This commit is contained in:
Ian Renton
2025-12-22 12:11:25 +00:00
parent c95c6bb347
commit 81da836bae

View File

@@ -3,7 +3,6 @@ import importlib
import logging import logging
import signal import signal
import sys import sys
from time import sleep
from diskcache import Cache from diskcache import Cache
from gevent import monkey; monkey.patch_all() from gevent import monkey; monkey.patch_all()
@@ -23,12 +22,11 @@ status_data = {}
spot_providers = [] spot_providers = []
alert_providers = [] alert_providers = []
cleanup_timer = None cleanup_timer = None
run = True
# Shutdown function # Shutdown function
def shutdown(sig, frame): def shutdown(sig, frame):
global spot_providers, alert_providers, cleanup_timer, spots, alerts, run 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:
@@ -40,7 +38,6 @@ def shutdown(sig, frame):
lookup_helper.stop() lookup_helper.stop()
spots.close() spots.close()
alerts.close() alerts.close()
run = False
# Utility method to get a spot provider based on the class specified in its config entry. # Utility method to get a spot provider based on the class specified in its config entry.
@@ -127,6 +124,3 @@ if __name__ == '__main__':
status_reporter.start() status_reporter.start()
logging.info("Startup complete.") logging.info("Startup complete.")
while (run):
sleep(1)