Ver código fonte

connect with 5 sec timeout

Alex Cheema 7 meses atrás
pai
commit
4c4d8d2e7a
1 arquivos alterados com 1 adições e 2 exclusões
  1. 1 2
      exo/networking/grpc/grpc_peer_handle.py

+ 1 - 2
exo/networking/grpc/grpc_peer_handle.py

@@ -46,8 +46,7 @@ class GRPCPeerHandle(PeerHandle):
     self.stub = None
 
   async def _ensure_connected(self):
-    if not await self.is_connected():
-      await self.connect()
+    if not await self.is_connected(): await asyncio.wait_for(self.connect(), timeout=5)
 
   async def health_check(self) -> bool:
     try: