mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-23 00:10:40 -04:00
Add support for batch sending new events
This commit is contained in:
parent
a7bdc4a1ed
commit
4eddcf6653
6 changed files with 86 additions and 20 deletions
|
@ -84,6 +84,7 @@ class ReplicationSendEventRestServlet(ReplicationEndpoint):
|
|||
requester: Requester,
|
||||
ratelimit: bool,
|
||||
extra_users: List[UserID],
|
||||
dont_notify: bool,
|
||||
) -> JsonDict:
|
||||
"""
|
||||
Args:
|
||||
|
@ -94,6 +95,7 @@ class ReplicationSendEventRestServlet(ReplicationEndpoint):
|
|||
context
|
||||
ratelimit
|
||||
extra_users: Any extra users to notify about event
|
||||
dont_notify
|
||||
"""
|
||||
serialized_context = await context.serialize(event, store)
|
||||
|
||||
|
@ -108,6 +110,7 @@ class ReplicationSendEventRestServlet(ReplicationEndpoint):
|
|||
"requester": requester.serialize(),
|
||||
"ratelimit": ratelimit,
|
||||
"extra_users": [u.to_string() for u in extra_users],
|
||||
"dont_notify": dont_notify,
|
||||
}
|
||||
|
||||
return payload
|
||||
|
@ -133,13 +136,18 @@ class ReplicationSendEventRestServlet(ReplicationEndpoint):
|
|||
|
||||
ratelimit = content["ratelimit"]
|
||||
extra_users = [UserID.from_string(u) for u in content["extra_users"]]
|
||||
dont_notify = content["dont_notify"]
|
||||
|
||||
logger.info(
|
||||
"Got event to send with ID: %s into room: %s", event.event_id, event.room_id
|
||||
)
|
||||
|
||||
event = await self.event_creation_handler.persist_and_notify_client_events(
|
||||
requester, [(event, context)], ratelimit=ratelimit, extra_users=extra_users
|
||||
requester,
|
||||
[(event, context)],
|
||||
ratelimit=ratelimit,
|
||||
extra_users=extra_users,
|
||||
dont_notify=dont_notify,
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue