summary refs log tree commit diff
path: root/synapse/storage/pdu.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-09-08 19:50:46 +0100
committerErik Johnston <erik@matrix.org>2014-09-08 19:50:59 +0100
commit83ce57302dab6a825f3afde11926b5404ce1c9ff (patch)
tree8a5266f56cf00880e26f69ca8a1312308ff3fc9d /synapse/storage/pdu.py
parentMake #matrix public rooms bold to make them stand out from the other public r... (diff)
downloadsynapse-83ce57302dab6a825f3afde11926b5404ce1c9ff.tar.xz
Fix bug in state handling where we incorrectly identified a missing pdu. Update tests to catch this case.
Diffstat (limited to 'synapse/storage/pdu.py')
-rw-r--r--synapse/storage/pdu.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/synapse/storage/pdu.py b/synapse/storage/pdu.py
index 0bf97e37ee..3cbce2d0a1 100644
--- a/synapse/storage/pdu.py
+++ b/synapse/storage/pdu.py
@@ -308,8 +308,8 @@ class PduStore(SQLBaseStore):
 
     @defer.inlineCallbacks
     def get_oldest_pdus_in_context(self, context):
-        """Get a list of Pdus that we haven't backfilled beyond yet (and haven't    
-        seen). This list is used when we want to backfill backwards and is the 
+        """Get a list of Pdus that we haven't backfilled beyond yet (and havent
+        seen). This list is used when we want to backfill backwards and is the
         list we send to the remote server.
 
         Args:
@@ -524,13 +524,16 @@ class StatePduStore(SQLBaseStore):
             txn, new_pdu, current
         )
 
+        missing_branch = None
         for branch, prev_state, state in enum_branches:
             if state:
                 return_value[branch].append(state)
             else:
+                # We don't have prev_state :(
+                missing_branch = branch
                 break
 
-        return return_value
+        return (return_value, missing_branch)
 
     def update_current_state(self, pdu_id, origin, context, pdu_type,
                              state_key):