Implemented old spot cleanup thread

This commit is contained in:
Ian Renton
2025-09-27 12:09:16 +01:00
parent b1346e26ea
commit efa4c402df
8 changed files with 73 additions and 13 deletions

11
main.py
View File

@@ -1,6 +1,8 @@
# Main script
import signal
from core.cleanup import CleanupTimer
from core.constants import MAX_SPOT_AGE_SEC
from providers.dxcluster import DXCluster
from providers.gma import GMA
from providers.hema import HEMA
@@ -10,15 +12,16 @@ from providers.sota import SOTA
from providers.wwbota import WWBOTA
from providers.wwff import WWFF
# Shutdown function
def shutdown(sig, frame):
print("Stopping program, this may take a few seconds...")
for p in providers: p.stop()
cleanup_timer.stop()
# Main function
if __name__ == '__main__':
print("Starting...")
# Shut down gracefully on SIGINT
signal.signal(signal.SIGINT, shutdown)
@@ -41,7 +44,9 @@ if __name__ == '__main__':
# Start data providers
for p in providers: p.start()
# todo thread to clear spot list of old data
# Set up timer to clear spot list of old data
cleanup_timer = CleanupTimer(spot_list=spot_list, cleanup_interval=60, max_spot_age=MAX_SPOT_AGE_SEC)
cleanup_timer.start()
# Todo serve spot API
# Todo spot API arguments e.g. "since" based on received_time of spots, sources, sigs, dx cont, dxcc, de cont, band, mode, filter out qrt, filter pre-qsy
@@ -49,6 +54,8 @@ if __name__ == '__main__':
# Todo serve apidocs
# Todo serve website
print("Startup complete.")
# TODO NOTES FOR NGINX REVERSE PROXY
# local cache time of 15 sec to avoid over burdening python?