diff --git a/app/routers/nodes.py b/app/routers/nodes.py index 090b00d..2766d8d 100644 --- a/app/routers/nodes.py +++ b/app/routers/nodes.py @@ -44,8 +44,13 @@ async def listen_to_client(websocket, client_id): request_id = data.get("request_id") if message_type == "response" and request_id in pending_requests: - future = pending_requests.pop(request_id) - if not future.done(): # Ensure the future hasn't been cancelled or set by something else + # Retrieve the dictionary containing the future and client_id + request_info = pending_requests.pop(request_id) + + # Extract the actual asyncio.Future object + future = request_info["future"] + + if not future.done(): # This will now correctly call .done() on the Future future.set_result(data.get("payload")) # Add other message types handling here if needed (e.g., unsolicited messages)