From 6966971a28bb6dfed3daef6e5cd2e41b1ce34788 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 26 Aug 2014 18:57:17 +0100 Subject: [PATCH] Use store.persist_event rather than pdu_actions.persist_outgoing/pdu_actions.persist_received --- synapse/federation/persistence.py | 19 ------------------- synapse/federation/replication.py | 4 ++-- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/synapse/federation/persistence.py b/synapse/federation/persistence.py index 76d37a0c52..2286fca821 100644 --- a/synapse/federation/persistence.py +++ b/synapse/federation/persistence.py @@ -39,25 +39,6 @@ class PduActions(object): def __init__(self, datastore): self.store = datastore - @log_function - def persist_received(self, pdu): - """ Persists the given `Pdu` that was received from a remote home - server. - - Returns: - Deferred - """ - return self.store.persist_event(pdu=pdu) - - @log_function - def persist_outgoing(self, pdu): - """ Persists the given `Pdu` that this home server created. - - Returns: - Deferred - """ - return self.store.persist_event(pdu=pdu) - @log_function def mark_as_processed(self, pdu): """ Persist the fact that we have fully processed the given `Pdu` diff --git a/synapse/federation/replication.py b/synapse/federation/replication.py index cf634a64b2..731cb74dd2 100644 --- a/synapse/federation/replication.py +++ b/synapse/federation/replication.py @@ -137,7 +137,7 @@ class ReplicationLayer(object): #yield self.pdu_actions.populate_previous_pdus(pdu) # Save *before* trying to send - yield self.pdu_actions.persist_outgoing(pdu) + yield self.store.persist_event(pdu=pdu) logger.debug("[%s] Persisted PDU", pdu.pdu_id) logger.debug("[%s] transaction_layer.enqueue_pdu... ", pdu.pdu_id) @@ -450,7 +450,7 @@ class ReplicationLayer(object): logger.exception("Failed to get PDU") # Persist the Pdu, but don't mark it as processed yet. - yield self.pdu_actions.persist_received(pdu) + yield self.store.persist_event(pdu=pdu) if not backfilled: ret = yield self.handler.on_receive_pdu(pdu, backfilled=backfilled)