mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 02:54:52 -04:00
Reduce size of joined_user cache
The _get_joined_users_from_context cache stores a mapping from user_id to avatar_url and display_name. Instead of storing those in a dict, store them in a namedtuple as that uses much less memory. We also try converting the string to ascii to further reduce the size.
This commit is contained in:
parent
22f3d3ae76
commit
d9aa645f86
4 changed files with 40 additions and 11 deletions
|
@ -87,8 +87,11 @@ class BulkPushRuleEvaluator:
|
|||
condition_cache = {}
|
||||
|
||||
for uid, rules in self.rules_by_user.items():
|
||||
display_name = room_members.get(uid, {}).get("display_name", None)
|
||||
if not display_name:
|
||||
display_name = None
|
||||
profile_info = room_members.get(uid, {})
|
||||
if profile_info:
|
||||
display_name = profile_info.display_name
|
||||
else:
|
||||
# Handle the case where we are pushing a membership event to
|
||||
# that user, as they might not be already joined.
|
||||
if event.type == EventTypes.Member and event.state_key == uid:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue