2 files changed, 9 insertions, 0 deletions
diff --git a/synapse/storage/pdu.py b/synapse/storage/pdu.py
index d70467dcd6..b1cb0185a6 100644
--- a/synapse/storage/pdu.py
+++ b/synapse/storage/pdu.py
@@ -277,6 +277,12 @@ class PduStore(SQLBaseStore):
(context, depth)
)
+ def get_latest_pdus_in_context(self, context):
+ return self.runInteraction(
+ self._get_latest_pdus_in_context,
+ context
+ )
+
def _get_latest_pdus_in_context(self, txn, context):
"""Get's a list of the most current pdus for a given context. This is
used when we are sending a Pdu and need to fill out the `prev_pdus`
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index 9496c935a7..0aa979c9f0 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -63,6 +63,9 @@ class StateStore(SQLBaseStore):
)
def _store_state_groups_txn(self, txn, event):
+ if not event.state_events:
+ return
+
state_group = event.state_group
if not state_group:
state_group = self._simple_insert_txn(
|