add latency measure from ping in emc and ws_client

This commit is contained in:
Timothy Pogue
2022-11-02 19:30:35 -06:00
parent a0965606a5
commit b749f3edd6
2 changed files with 8 additions and 10 deletions

View File

@@ -240,12 +240,10 @@ async def create_client(
):
# Try pinging
try:
pong = ws.ping()
await asyncio.wait_for(
pong,
timeout=ping_timeout
)
logger.info("Connection still alive...")
pong = await ws.ping()
latency = (await asyncio.wait_for(pong, timeout=ping_timeout) * 1000)
logger.info(f"Connection still alive, latency: {latency}ms")
continue