Give some breath to the websocket ping loop

This commit is contained in:
Fabio Manganiello 2018-01-29 21:21:40 +01:00
parent 07219bef89
commit fc608317fd

View file

@ -123,6 +123,7 @@ class HttpBackend(Backend):
try: try:
waiter = await websocket.ping() waiter = await websocket.ping()
await asyncio.wait_for(waiter, timeout=5) await asyncio.wait_for(waiter, timeout=5)
time.sleep(0.1)
except (asyncio.TimeoutError, websockets.exceptions.ConnectionClosed) as e: except (asyncio.TimeoutError, websockets.exceptions.ConnectionClosed) as e:
logging.info('Client {} closed connection'.format(websocket.remote_address[0])) logging.info('Client {} closed connection'.format(websocket.remote_address[0]))
self.active_websockets.remove(websocket) self.active_websockets.remove(websocket)