mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Refactor utils.py as a helper class so we have some control about when the lookup services actually start
This commit is contained in:
@@ -8,8 +8,8 @@ from diskcache import Cache
|
||||
|
||||
from core.cleanup import CleanupTimer
|
||||
from core.config import config, WEB_SERVER_PORT
|
||||
from core.lookup_helper import lookup_helper
|
||||
from core.status_reporter import StatusReporter
|
||||
from core.utils import QRZ_CALLSIGN_DATA_CACHE
|
||||
from server.webserver import WebServer
|
||||
|
||||
# Globals
|
||||
@@ -31,8 +31,9 @@ def shutdown(sig, frame):
|
||||
if p.enabled:
|
||||
p.stop()
|
||||
cleanup_timer.stop()
|
||||
QRZ_CALLSIGN_DATA_CACHE.close()
|
||||
lookup_helper.stop()
|
||||
spots.close()
|
||||
alerts.close()
|
||||
|
||||
|
||||
# Utility method to get a spot provider based on the class specified in its config entry.
|
||||
@@ -65,6 +66,9 @@ if __name__ == '__main__':
|
||||
# Shut down gracefully on SIGINT
|
||||
signal.signal(signal.SIGINT, shutdown)
|
||||
|
||||
# Set up lookup helper
|
||||
lookup_helper.start()
|
||||
|
||||
# Fetch, set up and start spot providers
|
||||
for entry in config["spot-providers"]:
|
||||
spot_providers.append(get_spot_provider_from_config(entry))
|
||||
|
||||
Reference in New Issue
Block a user