mirror of https://gitlab.com/litecord/litecord.git
only dispatch to states with websockets
This commit is contained in:
parent
de8954066a
commit
64498ba3f2
|
|
@ -30,11 +30,12 @@ async def send_event_to_states(
|
||||||
"""Dispatch an event to a list of states."""
|
"""Dispatch an event to a list of states."""
|
||||||
res = []
|
res = []
|
||||||
|
|
||||||
|
event, data = event_data
|
||||||
for state in states:
|
for state in states:
|
||||||
try:
|
try:
|
||||||
event, data = event_data
|
if state.ws:
|
||||||
await state.ws.dispatch(event, data)
|
await state.ws.dispatch(event, data)
|
||||||
res.append(state.session_id)
|
res.append(state.session_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
log.exception("error while dispatching")
|
log.exception("error while dispatching")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue