This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Rename various ApplicationServices interested methods #11915
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
aaa402e
Rename various ApplicationServices interested methods
anoadragon453 fe17863
Add 'is_interested_in_user' and 'is_interested_in_room'
anoadragon453 a493a16
Update tests to use the new methods
anoadragon453 4866227
Remove _matches_user
anoadragon453 bcae63e
Remove inline'd _matches_room_id and _matches_aliases methods
anoadragon453 381b560
Add caching to ApplicationService.is_interested_in_event
anoadragon453 bf00539
Make matches_user_in_member_list method private; update refs
anoadragon453 27ffd6d
Changelog
anoadragon453 eb779e0
Type hints and docstring for _mkservice, _mkservice_alias
anoadragon453 453fdac
Add an event ID arg to is_interested_in_event to cache with
anoadragon453 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this will work exactly as we're hoping --
EventBase
equality is checked by it being the exact same object (i.e. if you built twoEventBase
instances with identical properties they aren't equal).This might be OK, but I'm not 100% sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch. Ideally we'd cache on the event's ID instead of
EventBase
. I don't suppose there's an easy way to do that with@cached
, though I can just create anLruCache
much as we do for_get_event_cache
:synapse/synapse/storage/databases/main/events_worker.py
Lines 240 to 243 in e2e1d90
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That might be better, in the past I've wonder if we should define
__eq__
onEventBase
which compares IDs, but I could see that not...being great in some situations.Maybe using it is fine though? Might want to check if we do it anywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the conversation in #synapse-dev, I believe we concluded on adding an
event_id
argument tois_interested_in_event
. Doing so was simple, though updating the tests was slightly tedious.Done in 453fdac!