mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 18:44:56 -04:00
Include bundled aggregations in the sync response cache. (#11659)
This commit is contained in:
parent
20c6d85c6e
commit
0c40c619aa
4 changed files with 19 additions and 19 deletions
|
@ -98,6 +98,9 @@ class TimelineBatch:
|
|||
prev_batch: StreamToken
|
||||
events: List[EventBase]
|
||||
limited: bool
|
||||
# A mapping of event ID to the bundled aggregations for the above events.
|
||||
# This is only calculated if limited is true.
|
||||
bundled_aggregations: Optional[Dict[str, Dict[str, Any]]] = None
|
||||
|
||||
def __bool__(self) -> bool:
|
||||
"""Make the result appear empty if there are no updates. This is used
|
||||
|
@ -630,10 +633,17 @@ class SyncHandler:
|
|||
|
||||
prev_batch_token = now_token.copy_and_replace("room_key", room_key)
|
||||
|
||||
# Don't bother to bundle aggregations if the timeline is unlimited,
|
||||
# as clients will have all the necessary information.
|
||||
bundled_aggregations = None
|
||||
if limited or newly_joined_room:
|
||||
bundled_aggregations = await self.store.get_bundled_aggregations(recents)
|
||||
|
||||
return TimelineBatch(
|
||||
events=recents,
|
||||
prev_batch=prev_batch_token,
|
||||
limited=limited or newly_joined_room,
|
||||
bundled_aggregations=bundled_aggregations,
|
||||
)
|
||||
|
||||
async def get_state_after_event(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue