summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-08-28 13:44:32 +0100
committerMark Haines <mark.haines@matrix.org>2014-08-28 13:45:35 +0100
commit15ab5f5ad8a3fd26762d2e4b18e06d5bdcaa5d95 (patch)
tree1b29415f3c23361e0225bec3a545df9d6f8ea46a
parentFix bug where we used UserID objects instead of strigns (diff)
downloadsynapse-15ab5f5ad8a3fd26762d2e4b18e06d5bdcaa5d95.tar.xz
Merge backfill_ and backfill in federation handler
-rw-r--r--synapse/handlers/federation.py23
1 files changed, 5 insertions, 18 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 9023c3d403..220dbbb3a9 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -188,27 +188,14 @@ class FederationHandler(BaseHandler):
     @log_function
     @defer.inlineCallbacks
     def backfill(self, dest, room_id, limit):
-        events = yield self._backfill(dest, room_id, limit)
-
-        for event in events:
-            try:
-                yield self.store.persist_event(event, backfilled=True)
-            except:
-                logger.exception("Failed to persist event: %s", event)
-
-        defer.returnValue(events)
-
-    @defer.inlineCallbacks
-    def _backfill(self, dest, room_id, limit):
         pdus = yield self.replication_layer.backfill(dest, room_id, limit)
 
-        if not pdus:
-            defer.returnValue([])
+        events = []
 
-        events = [
-            self.pdu_codec.event_from_pdu(pdu)
-            for pdu in pdus
-        ]
+        for pdu in pdus:
+            event = self.pdu_codec.event_from_pdu(pdu)
+            events.append(event)
+            yield self.store.persist_event(event, backfilled=True)
 
         defer.returnValue(events)