From a8102be92d56e414bdc540400ae10ccb03a557a9 Mon Sep 17 00:00:00 2001 From: Kraiem Taha Yassine Date: Mon, 28 Jun 2021 16:36:23 +0200 Subject: [PATCH] Assist (#62) * feat(api): assist peerJS server * feat(api): install assist_server dependencies and start it with the API * feat(api): assist: list live sessions * feat(nginx): expose assist_server and block peers listing * feat(api): merged sourcemaps reader and assist-server feat(api): change image definition feat(api): changed service start command feat(utilities): created full server & image definition feat(nginx): reset chalice configuration * feat(utilities): utilities.yaml * feat(nginx): utilities URL * feat(utilities): utilities template * feat(ci): Adding utilities GH action. Signed-off-by: Rajesh Rajendran * feat(utilities): build script * feat(utilities): build script fix image name * feat(utilities): tag and push image as latest * feat(api): tag and push image as latest * feat(api): extract peers host * feat(api): fixed utilities URL * feat(api): assist logs * feat(api): assist: fixed peerjs URL * feat(api): log peers URL * feat(api): assit: get all durations, even if it is not null Co-authored-by: Rajesh Rajendran --- api/chalicelib/core/assist.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/api/chalicelib/core/assist.py b/api/chalicelib/core/assist.py index 7f50647e9..50e1b0655 100644 --- a/api/chalicelib/core/assist.py +++ b/api/chalicelib/core/assist.py @@ -21,15 +21,11 @@ SESSION_PROJECTION_COLS = """s.project_id, def get_live_sessions(project_id): project_key = projects.get_project_key(project_id) - print("requesting the list of connected peers") - print(environ["peers"] + f"/{project_key}") connected_peers = requests.get(environ["peers"] + f"/{project_key}") if connected_peers.status_code != 200: print("!! issue with the peer-server") print(connected_peers.text) return [] - print("response") - print(connected_peers.json()) connected_peers = connected_peers.json().get("data", []) if len(connected_peers) == 0: @@ -40,10 +36,8 @@ def get_live_sessions(project_id): SELECT {SESSION_PROJECTION_COLS} FROM public.sessions AS s WHERE s.project_id = %(project_id)s - AND session_id IN %(connected_peers)s - AND duration IS NULL;""", + AND session_id IN %(connected_peers)s;""", {"project_id": project_id, "connected_peers": connected_peers}) - print(query) cur.execute(query) results = cur.fetchall() return helper.list_to_camel_case(results)