Refactor utils.py as a helper class so we have some control about when the lookup services actually start

This commit is contained in:
Ian Renton
2025-10-13 20:16:40 +01:00
parent 9d2b2a1f66
commit cfa3aaedb0
6 changed files with 431 additions and 412 deletions

View File

@@ -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))