Split up the updating of service status and serving requests into two threads.

This commit is contained in:
2025-08-29 21:39:04 +02:00
parent ce811eae7e
commit d7a118931b
4 changed files with 51 additions and 96 deletions

22
main.py Normal file
View File

@@ -0,0 +1,22 @@
# import requests as r
from flask import jsonify, Flask
from poll_services import update_services
from mem import services
import threading
# Flask app to serve status
app = Flask(__name__)
@app.route("/")
def status():
return jsonify([s.to_dict() for s in services])
# Only run if directly running file
if __name__ == "__main__":
threading.Thread(target=update_services, daemon=True).start()
# Run flask app
app.run(debug=True, use_reloader=False)