-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Make get_room_version use cached get_room_version_id. #11808
Changes from 5 commits
ea23217
397459e
1852397
73ffce1
3ca4687
2d33cbc
8b63570
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Make method `get_room_version` use cached `get_room_version_id`. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -727,6 +727,7 @@ def test_unknown_room_version(self): | |||||||||||||||||||||
| desc="updated-room-version", | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
| self.hs.get_datastores().main.get_room_version_id.invalidate((self.room,)) | ||||||||||||||||||||||
|
Contributor
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. Why is this needed? It's bad practice to add invalidations for the tests since it might cover up an invalidation problem in the real code (I ran into this too during one of my recent PRs).
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. The test tests whether a room summary still succeeds, even if the room's version is invalid. To do so, it sets the room version id to I actually included a comment now.
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. What is weird though, is that removing these lines synapse/tests/handlers/test_room_summary.py Lines 722 to 729 in 3655585
(and not invalidating The first approach fails here synapse/tests/handlers/test_room_summary.py Line 734 in 3655585
with while the latter fails here synapse/tests/handlers/test_room_summary.py Line 731 in 3655585
with
Contributor
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. Looking at this one, it seems like it occurs because the event fetching code fetches the room version separately and then encounters a room version it doesn't understand: it then skips fetching that event. (This is a design choice: events in unknown room versions are treated as nonexistent events because we don't know how to decode them) I think that's fine; in practice the version of a room doesn't change and so there's no way the cache would get out of sync with the database. This is happening because if you don't set the room version to something unknown, the code will (correctly) generate a room summary entry for it, which the test doesn't expect for unknown room versions. I think your code is therefore fine as-is! |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| result = self.get_success(self.handler.get_space_summary(self.user, self.space)) | ||||||||||||||||||||||
| # The result should have only the space, along with a link from space -> room. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.