mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 16:59:25 +00:00
Status API
This commit is contained in:
12
main.py
12
main.py
@@ -55,8 +55,9 @@ if __name__ == '__main__':
|
||||
DXCluster("hrd.wa9pie.net", 8000),
|
||||
# DXCluster("dxc.w3lpl.net", 22)
|
||||
]
|
||||
# Set up spot list
|
||||
# Set up spot list & status data areas
|
||||
spot_list = []
|
||||
status_data = {}
|
||||
# Set up data providers
|
||||
for p in providers: p.setup(spot_list=spot_list)
|
||||
# Start data providers
|
||||
@@ -67,13 +68,18 @@ if __name__ == '__main__':
|
||||
cleanup_timer.start()
|
||||
|
||||
# Set up web server
|
||||
web_server = WebServer(spot_list=spot_list, port=config["web-server-port"])
|
||||
web_server = WebServer(spot_list=spot_list, status_data=status_data, port=config["web-server-port"])
|
||||
web_server.start()
|
||||
|
||||
logging.info("Startup complete.")
|
||||
|
||||
# While running, update the status information at a regular interval
|
||||
while run:
|
||||
sleep(1)
|
||||
sleep(5)
|
||||
for p in providers: status_data[p.name()] = {"status": p.status, "last_updated": p.last_update_time, "last_spot": p.last_spot_time}
|
||||
status_data["Cleanup Timer"] = {"status": cleanup_timer.status, "last_ran": cleanup_timer.last_cleanup_time}
|
||||
status_data["Web Server"] = {"status": web_server.status, "last_api_access": web_server.last_api_access_time, "last_page_access": web_server.last_page_access_time}
|
||||
|
||||
|
||||
|
||||
# TODO NOTES FOR NGINX REVERSE PROXY
|
||||
|
||||
Reference in New Issue
Block a user