From 5da0be552c911c4d4861f3338ea102c8d80602bc Mon Sep 17 00:00:00 2001 From: Untriex Programming Date: Fri, 5 Mar 2021 19:09:00 +0100 Subject: [PATCH] Update main.py --- main.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 5257884..ef3081d 100644 --- a/main.py +++ b/main.py @@ -44,8 +44,8 @@ def heartbeat(s_table: Server_table, request: Request): try: for position, server_id in enumerate(s_table.ID): if server_id in heartbeat_table["ID"]: - if heartbeat_table["last_heartbeat"][heartbeat_table["ID"].index(server_id)] > s_table.last_heartbeat[ - position]: + if heartbeat_table["last_heartbeat"][heartbeat_table["ID"].index(server_id)] > \ + s_table.last_heartbeat[position]: heartbeat_table["last_heartbeat"][heartbeat_table["ID"].index(server_id)] = s_table.last_heartbeat[ position] else: @@ -64,3 +64,15 @@ def get_sensors(request: Request): log.message(f"sensor data sent to {request.client.host}:{request.client.port}") log.debug(f"sensor data: {sensors}") return sensors + + +@app.get("/files/{file}") +def get_file(file: str): + pass + + +def send_heartbeat(server_table, ID, files_table): + pass + +while True: + for server in heartbeat_table["IP"]: