refac
This commit is contained in:
1 parent
d0f759ce40
commit
858e9236df
1 file changed
+13
-10
@@ -960,16 +960,19 @@ async def get_event_emitter(request_info, update_db=True):
|
|||||||
if internal and event_data.get('type') == 'notification':
|
if internal and event_data.get('type') == 'notification':
|
||||||
return
|
return
|
||||||
|
|
||||||
await sio.emit(
|
room = f'user:{user_id}'
|
||||||
'events',
|
# Local rooms are authoritative; Redis may have listeners on another instance.
|
||||||
{
|
if WEBSOCKET_MANAGER == 'redis' or room in sio.manager.rooms.get('/', {}):
|
||||||
'chat_id': chat_id,
|
await sio.emit(
|
||||||
'message_id': message_id,
|
'events',
|
||||||
**({'internal': True} if internal else {}),
|
{
|
||||||
'data': event_data,
|
'chat_id': chat_id,
|
||||||
},
|
'message_id': message_id,
|
||||||
room=f'user:{user_id}',
|
**({'internal': True} if internal else {}),
|
||||||
)
|
'data': event_data,
|
||||||
|
},
|
||||||
|
room=room,
|
||||||
|
)
|
||||||
|
|
||||||
if update_db and message_id and not (request_info.get('chat_id') or '').startswith('local:'):
|
if update_db and message_id and not (request_info.get('chat_id') or '').startswith('local:'):
|
||||||
event_type = event_data.get('type')
|
event_type = event_data.get('type')
|
||||||
|
|||||||
Reference in new issue
Block a user