refac
Co-Authored-By: Algorithm5838 <108630393+Algorithm5838@users.noreply.github.com>
This commit is contained in:
co-authored by
Algorithm5838
parent
e9011113b4
commit
ff86283be0
@@ -790,6 +790,7 @@ def get_event_emitter(request_info, update_db=True):
|
|||||||
},
|
},
|
||||||
room=f"user:{user_id}",
|
room=f"user:{user_id}",
|
||||||
)
|
)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
update_db
|
update_db
|
||||||
and message_id
|
and message_id
|
||||||
@@ -799,16 +800,12 @@ def get_event_emitter(request_info, update_db=True):
|
|||||||
event_type = event_data.get("type")
|
event_type = event_data.get("type")
|
||||||
|
|
||||||
if event_type == "status":
|
if event_type == "status":
|
||||||
# Only persist final (done) status to DB; intermediate
|
await asyncio.to_thread(
|
||||||
# statuses are ephemeral UI-only data sent via socket.
|
Chats.add_message_status_to_chat_by_id_and_message_id,
|
||||||
status_data = event_data.get("data", {})
|
request_info["chat_id"],
|
||||||
if status_data.get("done", False):
|
request_info["message_id"],
|
||||||
await asyncio.to_thread(
|
status_data,
|
||||||
Chats.add_message_status_to_chat_by_id_and_message_id,
|
)
|
||||||
request_info["chat_id"],
|
|
||||||
request_info["message_id"],
|
|
||||||
status_data,
|
|
||||||
)
|
|
||||||
|
|
||||||
elif event_type == "message":
|
elif event_type == "message":
|
||||||
message = await asyncio.to_thread(
|
message = await asyncio.to_thread(
|
||||||
|
|||||||
Reference in New Issue
Block a user