mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-02-04 01:04:33 +00:00
Use SSE frontend #3
This commit is contained in:
16
spothole.py
16
spothole.py
@@ -1,14 +1,18 @@
|
||||
# Main script
|
||||
from time import sleep
|
||||
|
||||
import gevent
|
||||
from gevent import monkey; monkey.patch_all()
|
||||
|
||||
import importlib
|
||||
import logging
|
||||
import signal
|
||||
import sys
|
||||
|
||||
from diskcache import Cache
|
||||
from gevent import monkey; monkey.patch_all()
|
||||
|
||||
from core.cleanup import CleanupTimer
|
||||
from core.config import config, WEB_SERVER_PORT, SERVER_OWNER_CALLSIGN, MAX_SPOT_AGE
|
||||
from core.config import config, WEB_SERVER_PORT, SERVER_OWNER_CALLSIGN
|
||||
from core.constants import SOFTWARE_NAME, SOFTWARE_VERSION
|
||||
from core.lookup_helper import lookup_helper
|
||||
from core.status_reporter import StatusReporter
|
||||
@@ -22,10 +26,13 @@ status_data = {}
|
||||
spot_providers = []
|
||||
alert_providers = []
|
||||
cleanup_timer = None
|
||||
run = True
|
||||
|
||||
|
||||
# Shutdown function
|
||||
def shutdown(sig, frame):
|
||||
global run
|
||||
|
||||
logging.info("Stopping program, this may take a few seconds...")
|
||||
for p in spot_providers:
|
||||
if p.enabled:
|
||||
@@ -37,6 +44,7 @@ def shutdown(sig, frame):
|
||||
lookup_helper.stop()
|
||||
spots.close()
|
||||
alerts.close()
|
||||
run = False
|
||||
|
||||
|
||||
# Utility method to get a spot provider based on the class specified in its config entry.
|
||||
@@ -105,3 +113,7 @@ if __name__ == '__main__':
|
||||
status_reporter.start()
|
||||
|
||||
logging.info("Startup complete.")
|
||||
|
||||
while run:
|
||||
gevent.sleep(1)
|
||||
exit(0)
|
||||
|
||||
Reference in New Issue
Block a user