From 474dcecb1166440aa0e207aa978b9a822460f5bc Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Wed, 27 Aug 2014 11:34:31 +0100 Subject: [PATCH] Remove unused populate_previous_pdus --- synapse/federation/persistence.py | 19 ------------------- synapse/federation/replication.py | 2 -- synapse/storage/pdu.py | 7 +------ 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/synapse/federation/persistence.py b/synapse/federation/persistence.py index 2286fca821..4cf72b2e42 100644 --- a/synapse/federation/persistence.py +++ b/synapse/federation/persistence.py @@ -48,25 +48,6 @@ class PduActions(object): """ return self.store.mark_pdu_as_processed(pdu.pdu_id, pdu.origin) - @defer.inlineCallbacks - @log_function - def populate_previous_pdus(self, pdu): - """ Given an outgoing `Pdu` fill out its `prev_ids` key with the `Pdu`s - that we have received. - - Returns: - Deferred - """ - results = yield self.store.get_latest_pdus_in_context(pdu.context) - - pdu.prev_pdus = [(p_id, origin) for p_id, origin, _ in results] - - vs = [int(v) for _, _, v in results] - if vs: - pdu.depth = max(vs) + 1 - else: - pdu.depth = 0 - @defer.inlineCallbacks @log_function def after_transaction(self, transaction_id, destination, origin): diff --git a/synapse/federation/replication.py b/synapse/federation/replication.py index 731cb74dd2..38ae360bcd 100644 --- a/synapse/federation/replication.py +++ b/synapse/federation/replication.py @@ -134,8 +134,6 @@ class ReplicationLayer(object): logger.debug("[%s] Persisting PDU", pdu.pdu_id) - #yield self.pdu_actions.populate_previous_pdus(pdu) - # Save *before* trying to send yield self.store.persist_event(pdu=pdu) diff --git a/synapse/storage/pdu.py b/synapse/storage/pdu.py index 657295b1d7..9fd44f2454 100644 --- a/synapse/storage/pdu.py +++ b/synapse/storage/pdu.py @@ -276,7 +276,7 @@ class PduStore(SQLBaseStore): (context, depth) ) - def get_latest_pdus_in_context(self, 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` key @@ -285,11 +285,6 @@ class PduStore(SQLBaseStore): txn context """ - return self._db_pool.runInteraction( - self._get_latest_pdus_in_context, context - ) - - def _get_latest_pdus_in_context(self, txn, context): query = ( "SELECT p.pdu_id, p.origin, p.depth FROM %(pdus)s as p " "INNER JOIN %(forward)s as f ON p.pdu_id = f.pdu_id "