diff options
author | Erik Johnston <erik@matrix.org> | 2014-10-30 10:11:06 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-10-30 10:11:06 +0000 |
commit | aa80900a8e8cd9e7305a66cec336a8e150c46651 (patch) | |
tree | af74586cefc96fd3189af4421d52cf21f88df564 /synapse/storage/event_federation.py | |
parent | Add a run_on_reactor function (diff) | |
download | synapse-aa80900a8e8cd9e7305a66cec336a8e150c46651.tar.xz |
Fix SQL so that accepts we may want to persist events twice.
Diffstat (limited to 'synapse/storage/event_federation.py')
-rw-r--r-- | synapse/storage/event_federation.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/storage/event_federation.py b/synapse/storage/event_federation.py index 5f94c31818..88d09d9ba8 100644 --- a/synapse/storage/event_federation.py +++ b/synapse/storage/event_federation.py @@ -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 |