mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:56:06 -04:00
Fix SQL so that accepts we may want to persist events twice.
This commit is contained in:
parent
53216a500d
commit
aa80900a8e
2 changed files with 47 additions and 25 deletions
|
@ -99,7 +99,8 @@ class EventFederationStore(SQLBaseStore):
|
|||
"event_id": event_id,
|
||||
"prev_event_id": e_id,
|
||||
"room_id": room_id,
|
||||
}
|
||||
},
|
||||
or_ignore=True,
|
||||
)
|
||||
|
||||
# Update the extremities table if this is not an outlier.
|
||||
|
@ -120,7 +121,7 @@ class EventFederationStore(SQLBaseStore):
|
|||
# We only insert as a forward extremity the new pdu if there are no
|
||||
# other pdus that reference it as a prev pdu
|
||||
query = (
|
||||
"INSERT INTO %(table)s (event_id, room_id) "
|
||||
"INSERT OR IGNORE INTO %(table)s (event_id, room_id) "
|
||||
"SELECT ?, ? WHERE NOT EXISTS ("
|
||||
"SELECT 1 FROM %(event_edges)s WHERE "
|
||||
"prev_event_id = ? "
|
||||
|
@ -144,7 +145,8 @@ class EventFederationStore(SQLBaseStore):
|
|||
values={
|
||||
"event_id": e_id,
|
||||
"room_id": room_id,
|
||||
}
|
||||
},
|
||||
or_ignore=True,
|
||||
)
|
||||
|
||||
# Also delete from the backwards extremities table all ones that
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue