mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-08-09 06:12:16 -04:00
Hack together a query param for batch sending non-historical events
This commit is contained in:
parent
4d95e65860
commit
84d583f267
4 changed files with 70 additions and 18 deletions
|
@ -1115,6 +1115,7 @@ class EventCreationHandler:
|
|||
ratelimit: bool = True,
|
||||
extra_users: Optional[List[UserID]] = None,
|
||||
ignore_shadow_ban: bool = False,
|
||||
dont_notify: bool = False,
|
||||
) -> EventBase:
|
||||
"""Processes a new event.
|
||||
|
||||
|
@ -1134,6 +1135,8 @@ class EventCreationHandler:
|
|||
ignore_shadow_ban: True if shadow-banned users should be allowed to
|
||||
send this event.
|
||||
|
||||
dont_notify
|
||||
|
||||
Return:
|
||||
If the event was deduplicated, the previous, duplicate, event. Otherwise,
|
||||
`event`.
|
||||
|
@ -1217,6 +1220,7 @@ class EventCreationHandler:
|
|||
context=context,
|
||||
ratelimit=ratelimit,
|
||||
extra_users=extra_users,
|
||||
dont_notify=dont_notify,
|
||||
),
|
||||
run_in_background(
|
||||
self.cache_joined_hosts_for_event, event, context
|
||||
|
@ -1235,6 +1239,7 @@ class EventCreationHandler:
|
|||
context: EventContext,
|
||||
ratelimit: bool = True,
|
||||
extra_users: Optional[List[UserID]] = None,
|
||||
dont_notify: bool = False,
|
||||
) -> EventBase:
|
||||
"""Actually persists the event. Should only be called by
|
||||
`handle_new_client_event`, and see its docstring for documentation of
|
||||
|
@ -1246,7 +1251,7 @@ class EventCreationHandler:
|
|||
# The historical messages also do not have the proper `context.current_state_ids`
|
||||
# and `state_groups` because they have `prev_events` that aren't persisted yet
|
||||
# (historical messages persisted in reverse-chronological order).
|
||||
if not event.internal_metadata.is_historical():
|
||||
if not event.internal_metadata.is_historical() and not event.content.get(EventContentFields.MSC2716_HISTORICAL):
|
||||
await self.action_generator.handle_push_actions_for_event(event, context)
|
||||
|
||||
try:
|
||||
|
@ -1262,6 +1267,7 @@ class EventCreationHandler:
|
|||
context=context,
|
||||
ratelimit=ratelimit,
|
||||
extra_users=extra_users,
|
||||
dont_notify=dont_notify,
|
||||
)
|
||||
stream_id = result["stream_id"]
|
||||
event_id = result["event_id"]
|
||||
|
@ -1278,7 +1284,7 @@ class EventCreationHandler:
|
|||
return event
|
||||
|
||||
event = await self.persist_and_notify_client_event(
|
||||
requester, event, context, ratelimit=ratelimit, extra_users=extra_users
|
||||
requester, event, context, ratelimit=ratelimit, extra_users=extra_users, dont_notify=dont_notify,
|
||||
)
|
||||
|
||||
return event
|
||||
|
@ -1380,6 +1386,7 @@ class EventCreationHandler:
|
|||
context: EventContext,
|
||||
ratelimit: bool = True,
|
||||
extra_users: Optional[List[UserID]] = None,
|
||||
dont_notify: bool = False,
|
||||
) -> EventBase:
|
||||
"""Called when we have fully built the event, have already
|
||||
calculated the push actions for the event, and checked auth.
|
||||
|
@ -1634,6 +1641,11 @@ class EventCreationHandler:
|
|||
# If there's an expiry timestamp on the event, schedule its expiry.
|
||||
self._message_handler.maybe_schedule_expiry(event)
|
||||
|
||||
if dont_notify:
|
||||
# Skip notifying clients, this is used for Beeper's custom
|
||||
# batch sending of non-historical messages.
|
||||
return event
|
||||
|
||||
async def _notify() -> None:
|
||||
try:
|
||||
await self.notifier.on_new_room_event(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue