mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Correctly handle reindexing state groups that already have an edge
This commit is contained in:
parent
9e6d88f4e2
commit
a7032abb2e
@ -673,6 +673,17 @@ class StateStore(SQLBaseStore):
|
||||
if not row or not state_group:
|
||||
return True, count
|
||||
|
||||
txn.execute(
|
||||
"SELECT state_group FROM state_group_edges"
|
||||
" WHERE state_group = ?",
|
||||
(state_group,)
|
||||
)
|
||||
|
||||
# If we reach a point where we've already started inserting
|
||||
# edges we should stop.
|
||||
if txn.fetchall():
|
||||
return True, count
|
||||
|
||||
txn.execute(
|
||||
"SELECT coalesce(max(id), 0) FROM state_groups"
|
||||
" WHERE id < ? AND room_id = ?",
|
||||
@ -709,6 +720,14 @@ class StateStore(SQLBaseStore):
|
||||
if prev_state.get(key, None) != value
|
||||
}
|
||||
|
||||
self._simple_delete_txn(
|
||||
txn,
|
||||
table="state_group_edges",
|
||||
keyvalues={
|
||||
"state_group": state_group,
|
||||
}
|
||||
)
|
||||
|
||||
self._simple_insert_txn(
|
||||
txn,
|
||||
table="state_group_edges",
|
||||
|
Loading…
Reference in New Issue
Block a user