summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-03-24 13:23:11 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-03-24 13:23:11 +0000
commit698962af0a7126138c9efd55281ed43b5c67c0d7 (patch)
tree9f8ea7beae68b8b7cc94872a245a1c7542c777b4 /synapse/storage
parentFix minor issues with email config (#6962) (diff)
parentUpsert room version when we join over federation (#6968) (diff)
downloadsynapse-698962af0a7126138c9efd55281ed43b5c67c0d7.tar.xz
Upsert room version when we join over federation (#6968)
* commit 'a301934f4':
  Upsert room version when we join over federation (#6968)
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/data_stores/main/room.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/synapse/storage/data_stores/main/room.py b/synapse/storage/data_stores/main/room.py

index 9c63ca5a20..009ad8c038 100644 --- a/synapse/storage/data_stores/main/room.py +++ b/synapse/storage/data_stores/main/room.py
@@ -977,6 +977,23 @@ class RoomStore(RoomBackgroundUpdateStore, RoomWorkerStore, SearchStore): self.config = hs.config + async def upsert_room_on_join(self, room_id: str, room_version: RoomVersion): + """Ensure that the room is stored in the table + + Called when we join a room over federation, and overwrites any room version + currently in the table. + """ + await self.db.simple_upsert( + desc="upsert_room_on_join", + table="rooms", + keyvalues={"room_id": room_id}, + values={"room_version": room_version.identifier}, + insertion_values={"is_public": False, "creator": ""}, + # rooms has a unique constraint on room_id, so no need to lock when doing an + # emulated upsert. + lock=False, + ) + @defer.inlineCallbacks def store_room( self,