mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-01 14:06:06 -04:00
Fix message duplication if something goes wrong after persisting the event (#8476)
Should fix #3365.
This commit is contained in:
parent
a9a8f29729
commit
b2486f6656
13 changed files with 481 additions and 32 deletions
|
@ -46,6 +46,12 @@ class ReplicationSendEventRestServlet(ReplicationEndpoint):
|
|||
"ratelimit": true,
|
||||
"extra_users": [],
|
||||
}
|
||||
|
||||
200 OK
|
||||
|
||||
{ "stream_id": 12345, "event_id": "$abcdef..." }
|
||||
|
||||
The returned event ID may not match the sent event if it was deduplicated.
|
||||
"""
|
||||
|
||||
NAME = "send_event"
|
||||
|
@ -116,11 +122,17 @@ class ReplicationSendEventRestServlet(ReplicationEndpoint):
|
|||
"Got event to send with ID: %s into room: %s", event.event_id, event.room_id
|
||||
)
|
||||
|
||||
stream_id = await self.event_creation_handler.persist_and_notify_client_event(
|
||||
event = await self.event_creation_handler.persist_and_notify_client_event(
|
||||
requester, event, context, ratelimit=ratelimit, extra_users=extra_users
|
||||
)
|
||||
|
||||
return 200, {"stream_id": stream_id}
|
||||
return (
|
||||
200,
|
||||
{
|
||||
"stream_id": event.internal_metadata.stream_ordering,
|
||||
"event_id": event.event_id,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def register_servlets(hs, http_server):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue