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

Commit 56395f9

Browse files
committed
Insert into the stream when a room in un-partial-stated
1 parent 8d7bae8 commit 56395f9

File tree

1 file changed

+22
-5
lines changed
  • synapse/storage/databases/main

1 file changed

+22
-5
lines changed

synapse/storage/databases/main/room.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,10 +2305,14 @@ async def clear_partial_state_room(self, room_id: str) -> bool:
23052305
still contains events with partial state.
23062306
"""
23072307
try:
2308-
await self.db_pool.runInteraction(
2309-
"clear_partial_state_room", self._clear_partial_state_room_txn, room_id
2310-
)
2311-
return True
2308+
async with self._un_partial_stated_rooms_stream_id_gen.get_next() as un_partial_state_room_stream_id:
2309+
await self.db_pool.runInteraction(
2310+
"clear_partial_state_room",
2311+
self._clear_partial_state_room_txn,
2312+
room_id,
2313+
un_partial_state_room_stream_id,
2314+
)
2315+
return True
23122316
except self.db_pool.engine.module.IntegrityError as e:
23132317
# Assume that any `IntegrityError`s are due to partial state events.
23142318
logger.info(
@@ -2319,7 +2323,10 @@ async def clear_partial_state_room(self, room_id: str) -> bool:
23192323
return False
23202324

23212325
def _clear_partial_state_room_txn(
2322-
self, txn: LoggingTransaction, room_id: str
2326+
self,
2327+
txn: LoggingTransaction,
2328+
room_id: str,
2329+
un_partial_state_room_stream_id: int,
23232330
) -> None:
23242331
DatabasePool.simple_delete_txn(
23252332
txn,
@@ -2336,6 +2343,16 @@ def _clear_partial_state_room_txn(
23362343
txn, self.get_partial_state_servers_at_join, (room_id,)
23372344
)
23382345

2346+
DatabasePool.simple_insert_txn(
2347+
txn,
2348+
"un_partial_state_room_stream",
2349+
{
2350+
"stream_id": un_partial_state_room_stream_id,
2351+
"instance_name": self._instance_name,
2352+
"room_id": room_id,
2353+
},
2354+
)
2355+
23392356
# We now delete anything from `device_lists_remote_pending` with a
23402357
# stream ID less than the minimum
23412358
# `partial_state_rooms.device_lists_stream_id`, as we no longer need them.

0 commit comments

Comments
 (0)