move send delay to relay
This commit is contained in:
parent
5ada5eb540
commit
eb8c89fe31
@ -198,10 +198,6 @@ class ApiServer(RPCHandler):
|
||||
logger.debug(f"Found message of type: {message.get('type')}")
|
||||
# Broadcast it
|
||||
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:
|
||||
pass
|
||||
|
||||
|
@ -115,6 +115,12 @@ class WebSocketChannel:
|
||||
try:
|
||||
await self._send(message)
|
||||
self.queue.task_done()
|
||||
|
||||
# Limit messages per sec.
|
||||
# Could cause problems with queue size if too low, and
|
||||
# problems with network traffik if too high.
|
||||
# 0.001 = 1000/s
|
||||
await asyncio.sleep(0.001)
|
||||
except RuntimeError:
|
||||
# The connection was closed, just exit the task
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user