summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-11-12 11:22:51 +0000
committerErik Johnston <erik@matrix.org>2014-11-12 11:24:11 +0000
commit6fea478d2e7737c2462b074b935d4427ced5f3d4 (patch)
treeb14646c2e337e3a4d44fd7a61cb6bac60b8c42c6 /synapse/storage
parentSYWEB-146: Fix room ID leaking on recents page when the name of the room is j... (diff)
downloadsynapse-6fea478d2e7737c2462b074b935d4427ced5f3d4.tar.xz
Fix bugs with invites/joins across federatiom.
Both in terms of auth and not trying to fetch missing PDUs for invites,
joins etc.
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/__init__.py14
-rw-r--r--synapse/storage/state.py9
2 files changed, 17 insertions, 6 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index 4034437f6b..72290eb5a0 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -186,6 +186,7 @@ class DataStore(RoomMemberStore, RoomStore,
                 "events",
                 vals,
                 or_replace=(not outlier),
+                or_ignore=bool(outlier),
             )
         except:
             logger.warn(
@@ -217,7 +218,12 @@ class DataStore(RoomMemberStore, RoomStore,
             if hasattr(event, "replaces_state"):
                 vals["prev_state"] = event.replaces_state
 
-            self._simple_insert_txn(txn, "state_events", vals)
+            self._simple_insert_txn(
+                txn,
+                "state_events",
+                vals,
+                or_replace=True,
+            )
 
             self._simple_insert_txn(
                 txn,
@@ -227,7 +233,8 @@ class DataStore(RoomMemberStore, RoomStore,
                     "room_id": event.room_id,
                     "type": event.type,
                     "state_key": event.state_key,
-                }
+                },
+                or_replace=True,
             )
 
             for e_id, h in event.prev_state:
@@ -252,7 +259,8 @@ class DataStore(RoomMemberStore, RoomStore,
                         "room_id": event.room_id,
                         "type": event.type,
                         "state_key": event.state_key,
-                    }
+                    },
+                    or_replace=True,
                 )
 
                 for prev_state_id, _ in event.prev_state:
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index 68975969f5..2f3a70b4e5 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -70,7 +70,8 @@ class StateStore(SQLBaseStore):
                 values={
                     "room_id": event.room_id,
                     "event_id": event.event_id,
-                }
+                },
+                or_ignore=True,
             )
 
             for state in event.state_events.values():
@@ -83,7 +84,8 @@ class StateStore(SQLBaseStore):
                         "type": state.type,
                         "state_key": state.state_key,
                         "event_id": state.event_id,
-                    }
+                    },
+                    or_ignore=True,
                 )
 
         self._simple_insert_txn(
@@ -92,5 +94,6 @@ class StateStore(SQLBaseStore):
             values={
                 "state_group": state_group,
                 "event_id": event.event_id,
-            }
+            },
+            or_replace=True,
         )