This repository was 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
Check appservice user interest against the local users instead of all users (get_users_in_room mis-use)
#13958
Merged
anoadragon453
merged 23 commits into
develop
from
madlittlemods/13942-appservice-get_users_in_room-mis-uses
Oct 27, 2022
Merged
Changes from 4 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
99a623d
Check appservice user interest against the local users instead of all…
MadLittleMods 806b255
Remove non-appservice usages split out to other PRs
MadLittleMods 5f0f815
Add changelog
MadLittleMods a8be41b
Revert back to using our own `_matches_user_in_member_list` thing
MadLittleMods 72985df
Rename variables to 'local' to be obvious our intention
MadLittleMods 92b9da2
Fix tests
MadLittleMods 5d3c6a3
Wrapping happens at 88 chars
MadLittleMods 76435c7
Add actual homeserver tests for local/remote interesting to appservic…
MadLittleMods 4451998
Clarify interested/control and lints
MadLittleMods 1218f03
Revert mock
MadLittleMods 7bd3803
Add test descriptions
MadLittleMods 33f718c
Revert "Clarify interested/control and lints"
MadLittleMods cf8299b
Revert "Add test descriptions"
MadLittleMods 3de90e6
Revert "Revert mock"
MadLittleMods ab33cd6
Revert "Add actual homeserver tests for local/remote interesting to a…
MadLittleMods 3223512
Move tests over from #14000
MadLittleMods d913ceb
Merge branch 'develop' into madlittlemods/13942-appservice-get_users_…
MadLittleMods 4f29e75
Merge branch 'develop' into madlittlemods/13942-appservice-get_users_…
MadLittleMods 2665aa0
Update changelog
MadLittleMods 39e2ead
Add specific test to make sure local interesting user events are pick…
MadLittleMods 33a5b70
Update upgrade notes
MadLittleMods 92400ff
move comma
anoadragon453 426ef5c
Merge branch 'develop' of github.com:matrix-org/synapse into madlittl…
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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix performance bottleneck with heavy appservice and bridged users in Synapse by checking appservice user interest against the local users instead of all users. | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -172,7 +172,18 @@ async def _matches_user_in_member_list( | |
| Returns: | ||
| True if this service would like to know about this room. | ||
| """ | ||
| member_list = await store.get_users_in_room( | ||
| # We can use `get_local_users_in_room(...)` here because an application | ||
| # service can only act on behalf of users of the server it's on. | ||
| # | ||
| # In the future, we can consider re-using | ||
| # `store.get_app_service_users_in_room` which is very similar to this | ||
| # function but has a slightly worse performance than this because we | ||
| # have an early escape-hatch if we find a single user that the | ||
| # appservice is interested in. The juice would be worth the squeeze if | ||
| # `store.get_app_service_users_in_room` was used in more places besides | ||
| # an experimental MSC. But for now we can avoid doing more work and | ||
anoadragon453 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # barely using it later. | ||
|
Comment on lines
+179
to
+186
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For more context on this comment, see #13958 (comment) |
||
| member_list = await store.get_local_users_in_room( | ||
| room_id, on_invalidate=cache_context.invalidate | ||
| ) | ||
|
|
||
|
|
||
This file contains hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.
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.
For anyone curious, there might be a few more
get_users_in_roommis-uses in thesyncandpresencecode for someone who has more domain knowledge on what those things should exactly do.For example #13967 (feel free to pick it up)