mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-09 04:22:37 -04:00
Resync state after partial-state join (#12394)
We work through all the events with partial state, updating the state at each of them. Once it's done, we recalculate the state for the whole room, and then mark the room as having complete state.
This commit is contained in:
parent
86cf6a3a17
commit
320186319a
8 changed files with 289 additions and 0 deletions
|
@ -1979,3 +1979,27 @@ class EventsWorkerStore(SQLBaseStore):
|
|||
desc="is_partial_state_event",
|
||||
)
|
||||
return result is not None
|
||||
|
||||
async def get_partial_state_events_batch(self, room_id: str) -> List[str]:
|
||||
"""Get a list of events in the given room that have partial state"""
|
||||
return await self.db_pool.runInteraction(
|
||||
"get_partial_state_events_batch",
|
||||
self._get_partial_state_events_batch_txn,
|
||||
room_id,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _get_partial_state_events_batch_txn(
|
||||
txn: LoggingTransaction, room_id: str
|
||||
) -> List[str]:
|
||||
txn.execute(
|
||||
"""
|
||||
SELECT event_id FROM partial_state_events AS pse
|
||||
JOIN events USING (event_id)
|
||||
WHERE pse.room_id = ?
|
||||
ORDER BY events.stream_ordering
|
||||
LIMIT 100
|
||||
""",
|
||||
(room_id,),
|
||||
)
|
||||
return [row[0] for row in txn]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue