From df23e29971ceaea0cd198160b27654488631a1e9 Mon Sep 17 00:00:00 2001 From: cybermaggedon Date: Tue, 3 Dec 2024 09:52:00 +0000 Subject: [PATCH] Add debug to endpoint (#188) --- trustgraph-flow/trustgraph/api/gateway/endpoint.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/trustgraph-flow/trustgraph/api/gateway/endpoint.py b/trustgraph-flow/trustgraph/api/gateway/endpoint.py index af7a5070..dc380f4b 100644 --- a/trustgraph-flow/trustgraph/api/gateway/endpoint.py +++ b/trustgraph-flow/trustgraph/api/gateway/endpoint.py @@ -62,6 +62,8 @@ async def handle(self, request): id = str(uuid.uuid4()) + print(request.path, "...") + try: ht = request.headers["Authorization"] tokens = ht.split(" ", 2) @@ -78,23 +80,31 @@ async def handle(self, request): data = await request.json() + print(data) + q = await self.sub.subscribe(id) await self.pub.send( id, self.to_request(data), ) + print("Request sent") try: resp = await asyncio.wait_for(q.get(), self.timeout) except: raise RuntimeError("Timeout waiting for response") + print("Response got") + if resp.error: + print("Error") return web.json_response( { "error": resp.error.message } ) + print("Send response") + return web.json_response( self.from_response(resp) )