mirror of
https://github.com/element-hq/synapse
synced 2024-09-11 01:55:11 +00:00
Merge backfill_ and backfill in federation handler
This commit is contained in:
parent
b485d622cc
commit
15ab5f5ad8
1 changed files with 5 additions and 18 deletions
|
@ -188,27 +188,14 @@ class FederationHandler(BaseHandler):
|
||||||
@log_function
|
@log_function
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def backfill(self, dest, room_id, limit):
|
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)
|
pdus = yield self.replication_layer.backfill(dest, room_id, limit)
|
||||||
|
|
||||||
if not pdus:
|
events = []
|
||||||
defer.returnValue([])
|
|
||||||
|
|
||||||
events = [
|
for pdu in pdus:
|
||||||
self.pdu_codec.event_from_pdu(pdu)
|
event = self.pdu_codec.event_from_pdu(pdu)
|
||||||
for pdu in pdus
|
events.append(event)
|
||||||
]
|
yield self.store.persist_event(event, backfilled=True)
|
||||||
|
|
||||||
defer.returnValue(events)
|
defer.returnValue(events)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue