mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 16:59:25 +00:00
Implemented old spot cleanup thread
This commit is contained in:
11
main.py
11
main.py
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user