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')}")
|
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
|
||||||
|
|
||||||
|
@ -115,6 +115,12 @@ class WebSocketChannel:
|
|||||||
try:
|
try:
|
||||||
await self._send(message)
|
await self._send(message)
|
||||||
self.queue.task_done()
|
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:
|
except RuntimeError:
|
||||||
# The connection was closed, just exit the task
|
# The connection was closed, just exit the task
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user