Bring back asyncio.sleep to avoid overwelming the a consumer queue

This commit is contained in:
Matthias 2022-10-17 19:29:30 +02:00
parent c8e103e4a4
commit b166c04cba

View File

@ -198,6 +198,10 @@ class ApiServer(RPCHandler):
logger.debug(f"Found message of type: {message.get('type')}") logger.debug(f"Found message of type: {message.get('type')}")
# Broadcast it # Broadcast it
await self._ws_channel_manager.broadcast(message) await self._ws_channel_manager.broadcast(message)
# Limit messages per sec.
# Could cause problems with queue size if too low, and
# problems with network traffik if too high.
await asyncio.sleep(0.001)
except asyncio.CancelledError: except asyncio.CancelledError:
pass pass