Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

initial cut at a room summary API #3574

Merged
merged 52 commits into from
Aug 16, 2018
Merged
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
7b7fd27
untested attempt at deduplicating lazy-loaded members
ara4n Jun 3, 2018
c341d81
Merge branch 'develop' into matthew/remove_redundant_lazy_members
ara4n Jun 10, 2018
f7bd5da
add include_redundant_members filter option & make it work
ara4n Jun 10, 2018
589e5aa
merge and apply isort
ara4n Jul 19, 2018
8e66dd1
merge in #2970
ara4n Jul 19, 2018
a08b37b
fix bad merge
ara4n Jul 19, 2018
7362e6c
make /context lazyload & filter aware
ara4n Jul 20, 2018
cd28d2f
speed up /members and add at= and membership params
ara4n Jul 20, 2018
a17f0b6
make it work
ara4n Jul 20, 2018
9ba6ef2
Merge branch 'matthew/lazy_load_apis' into matthew/members_at
ara4n Jul 20, 2018
c6117fa
make it work
ara4n Jul 20, 2018
8f1585d
make filtering work
ara4n Jul 21, 2018
42308c0
initial cut at a room summary API
ara4n Jul 23, 2018
0beeecf
remove debug log
ara4n Jul 23, 2018
63ce31b
namespace the summary fields correctly
ara4n Jul 23, 2018
c8cbede
fix key typo
bwindels Jul 23, 2018
f9c3c26
Merge branch 'matthew/filter_members' into matthew/remove_redundant_l…
ara4n Jul 23, 2018
c2870ab
Merge branch 'matthew/remove_redundant_lazy_members' into matthew/laz…
ara4n Jul 23, 2018
ffb7a4c
Merge branch 'matthew/lazy_load_apis' into matthew/members_at
ara4n Jul 23, 2018
c1c6ff1
Merge branch 'matthew/members_at' into matthew/room_summary
ara4n Jul 23, 2018
7d99b0e
changelog
ara4n Jul 23, 2018
cd27a77
changelog
ara4n Jul 23, 2018
4018a6d
changelog
ara4n Jul 23, 2018
c238a88
changelog
ara4n Jul 23, 2018
1ba3683
return the correct counts & self-exclude from heros
ara4n Jul 24, 2018
f129390
spell heroes correctly
ara4n Jul 24, 2018
e61071a
fix heroes definition to match MSC
ara4n Jul 24, 2018
d32e5f8
Merge branch 'matthew/filter_members' into matthew/remove_redundant_l…
ara4n Jul 24, 2018
238f750
deduplicating redundant members via event_id rather than mxid
ara4n Jul 24, 2018
2a79e1a
Merge branch 'matthew/remove_redundant_lazy_members' into matthew/laz…
ara4n Jul 24, 2018
48f3e43
Merge branch 'matthew/lazy_load_apis' into matthew/members_at
ara4n Jul 24, 2018
7cc81ed
Merge branch 'matthew/members_at' into matthew/room_summary
ara4n Jul 24, 2018
08af91d
fix merge fail
ara4n Jul 24, 2018
e76254b
Merge branch 'matthew/members_at' into matthew/room_summary
ara4n Jul 24, 2018
e952368
incorporate review
ara4n Jul 30, 2018
2d9c062
Merge branch 'develop' into matthew/members_at
ara4n Aug 12, 2018
eebee08
convert /members?at= to take a stream token
ara4n Aug 12, 2018
5df2c36
Merge branch 'develop' into matthew/room_summary
ara4n Aug 12, 2018
d0c0d72
incorporate all the review feedback
ara4n Aug 12, 2018
b327e07
fix use of get_recent_event_ids_for_room
ara4n Aug 12, 2018
9e4acb7
Merge branch 'matthew/members_at' into matthew/room_summary
ara4n Aug 12, 2018
32bf4fa
return early rather than big if blocks
ara4n Aug 14, 2018
859ad35
incorporate PR review
ara4n Aug 14, 2018
dd4498f
Merge branch 'develop' into matthew/members_at
ara4n Aug 14, 2018
217d5dd
Merge branch 'develop' into matthew/members_at
ara4n Aug 15, 2018
8442478
Merge branch 'matthew/members_at' into matthew/room_summary
ara4n Aug 15, 2018
f5189b9
remove incorrectly reintroduced method
richvdh Aug 15, 2018
0d5770d
cleanups
richvdh Aug 15, 2018
c2d9c96
Merge branch 'matthew/members_at' into matthew/room_summary
richvdh Aug 15, 2018
dc085c0
Merge remote-tracking branch 'origin/develop' into matthew/room_summary
richvdh Aug 15, 2018
7306074
remove spurious changelogs
richvdh Aug 15, 2018
c3cdc21
factor out get_lazy_loaded_members_cache
ara4n Aug 15, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def compute_summary(self, room_id, sync_config, batch, state, now_token):

# ensure we send membership events for heroes if needed
cache_key = (sync_config.user.to_string(), sync_config.device_id)
cache = self.lazy_loaded_members_cache.get(cache_key)
cache = self.get_lazy_loaded_members_cache(cache_key)

# track which members the client should already know about via LL:
# Ones which are already in state...
Expand Down Expand Up @@ -626,6 +626,16 @@ def compute_summary(self, room_id, sync_config, batch, state, now_token):

defer.returnValue(summary)

def get_lazy_loaded_members_cache(self, cache_key):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: in future, please do add docstrings to public functions: in particular it's important to document the args and return types.

cache = self.lazy_loaded_members_cache.get(cache_key)
if cache is None:
logger.debug("creating LruCache for %r", cache_key)
cache = LruCache(LAZY_LOADED_MEMBERS_CACHE_MAX_SIZE)
self.lazy_loaded_members_cache[cache_key] = cache
else:
logger.debug("found LruCache for %r", cache_key)
return cache

@defer.inlineCallbacks
def compute_state_delta(self, room_id, batch, sync_config, since_token, now_token,
full_state):
Expand Down Expand Up @@ -741,13 +751,7 @@ def compute_state_delta(self, room_id, batch, sync_config, since_token, now_toke

if lazy_load_members and not include_redundant_members:
cache_key = (sync_config.user.to_string(), sync_config.device_id)
cache = self.lazy_loaded_members_cache.get(cache_key)
if cache is None:
logger.debug("creating LruCache for %r", cache_key)
cache = LruCache(LAZY_LOADED_MEMBERS_CACHE_MAX_SIZE)
self.lazy_loaded_members_cache[cache_key] = cache
else:
logger.debug("found LruCache for %r", cache_key)
cache = self.get_lazy_loaded_members_cache(cache_key)

# if it's a new sync sequence, then assume the client has had
# amnesia and doesn't want any recent lazy-loaded members
Expand Down