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

Speed up calculating push rules #2238

Merged
merged 3 commits into from
May 22, 2017
Merged

Conversation

erikjohnston
Copy link
Member

No description provided.

if key[0] != EventTypes.Member:
continue

user_id = key[1]
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are optimising it might be worth noting that a, b = key seems to be faster than a = key[0], b = key[1]

@@ -200,6 +200,10 @@ def __init__(self, hs, room_id, rules_for_room_cache):
# not update the cache with it.
self.sequence = 0

# A cache of user_ids that we *know* aren't interesting, e.g. user_ids
# owned by AS's, or remote users, etc.
self.uninteresting_user_set = set()
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we have a comment explaining why this cache doesn't need invalidation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also might be worth explaining that "uninteresting" means "will never have push rules on this server"

@NegativeMjark
Copy link
Contributor

Other than commenting on the uninteresting_user_set LGTM.

Copy link
Contributor

@NegativeMjark NegativeMjark left a comment

Choose a reason for hiding this comment

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

LGTM

@erikjohnston erikjohnston merged commit ccd6241 into develop May 22, 2017
@erikjohnston erikjohnston deleted the erikj/faster_push_rules branch October 26, 2017 11:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants