mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 16:59:25 +00:00
Implement a max spot age filter. Closes #18
This commit is contained in:
10
main.py
10
main.py
@@ -10,7 +10,8 @@ import psutil
|
||||
import pytz
|
||||
|
||||
from core.cleanup import CleanupTimer
|
||||
from core.config import config
|
||||
from core.config import config, MAX_SPOT_AGE, WEB_SERVER_PORT, SERVER_OWNER_CALLSIGN
|
||||
from core.constants import SOFTWARE_VERSION
|
||||
from providers.aprsis import APRSIS
|
||||
from providers.dxcluster import DXCluster
|
||||
from providers.gma import GMA
|
||||
@@ -76,8 +77,11 @@ if __name__ == '__main__':
|
||||
formatter = logging.Formatter("%(message)s")
|
||||
handler.setFormatter(formatter)
|
||||
root.addHandler(handler)
|
||||
|
||||
logging.info("Starting...")
|
||||
startup_time = datetime.now(pytz.UTC)
|
||||
status_data["software-version"] = SOFTWARE_VERSION
|
||||
status_data["server-owner-callsign"] = SERVER_OWNER_CALLSIGN
|
||||
|
||||
# Shut down gracefully on SIGINT
|
||||
signal.signal(signal.SIGINT, shutdown)
|
||||
@@ -92,11 +96,11 @@ if __name__ == '__main__':
|
||||
p.start()
|
||||
|
||||
# Set up timer to clear spot list of old data
|
||||
cleanup_timer = CleanupTimer(spot_list=spot_list, cleanup_interval=60, max_spot_age=config["max-spot-age-sec"])
|
||||
cleanup_timer = CleanupTimer(spot_list=spot_list, cleanup_interval=60, max_spot_age=MAX_SPOT_AGE)
|
||||
cleanup_timer.start()
|
||||
|
||||
# Set up web server
|
||||
web_server = WebServer(spot_list=spot_list, status_data=status_data, port=config["web-server-port"])
|
||||
web_server = WebServer(spot_list=spot_list, status_data=status_data, port=WEB_SERVER_PORT)
|
||||
web_server.start()
|
||||
|
||||
logging.info("Startup complete.")
|
||||
|
||||
Reference in New Issue
Block a user