Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
remove dead transaction persist code (#5622)
Browse files Browse the repository at this point in the history
this hasn't done anything for years
  • Loading branch information
richvdh authored Jul 5, 2019
1 parent 9481707 commit a6a776f
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 69 deletions.
1 change: 1 addition & 0 deletions changelog.d/5622.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove dead code for persiting outgoing federation transactions.
32 changes: 0 additions & 32 deletions synapse/federation/persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

import logging

from twisted.internet import defer

from synapse.logging.utils import log_function

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -63,33 +61,3 @@ def set_response(self, origin, transaction, code, response):
return self.store.set_received_txn_response(
transaction.transaction_id, origin, code, response
)

@defer.inlineCallbacks
@log_function
def prepare_to_send(self, transaction):
""" Persists the `Transaction` we are about to send and works out the
correct value for the `prev_ids` key.
Returns:
Deferred
"""
transaction.prev_ids = yield self.store.prep_send_transaction(
transaction.transaction_id,
transaction.destination,
transaction.origin_server_ts,
)

@log_function
def delivered(self, transaction, response_code, response_dict):
""" Marks the given `Transaction` as having been successfully
delivered to the remote homeserver, and what the response was.
Returns:
Deferred
"""
return self.store.delivered_txn(
transaction.transaction_id,
transaction.destination,
response_code,
response_dict,
)
9 changes: 0 additions & 9 deletions synapse/federation/sender/transaction_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ def send_new_transaction(self, destination, pending_pdus, pending_edus):
len(edus),
)

logger.debug("TX [%s] Persisting transaction...", destination)

transaction = Transaction.create_new(
origin_server_ts=int(self.clock.time_msec()),
transaction_id=txn_id,
Expand All @@ -76,9 +74,6 @@ def send_new_transaction(self, destination, pending_pdus, pending_edus):

self._next_txn_id += 1

yield self._transaction_actions.prepare_to_send(transaction)

logger.debug("TX [%s] Persisted transaction", destination)
logger.info(
"TX [%s] {%s} Sending transaction [%s]," " (PDUs: %d, EDUs: %d)",
destination,
Expand Down Expand Up @@ -118,10 +113,6 @@ def json_data_cb():

logger.info("TX [%s] {%s} got %d response", destination, txn_id, code)

yield self._transaction_actions.delivered(transaction, code, response)

logger.debug("TX [%s] {%s} Marked as delivered", destination, txn_id)

if code == 200:
for e_id, r in response.get("pdus", {}).items():
if "error" in r:
Expand Down
28 changes: 0 additions & 28 deletions synapse/storage/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,34 +133,6 @@ def set_received_txn_response(self, transaction_id, origin, code, response_dict)
desc="set_received_txn_response",
)

def prep_send_transaction(self, transaction_id, destination, origin_server_ts):
"""Persists an outgoing transaction and calculates the values for the
previous transaction id list.
This should be called before sending the transaction so that it has the
correct value for the `prev_ids` key.
Args:
transaction_id (str)
destination (str)
origin_server_ts (int)
Returns:
list: A list of previous transaction ids.
"""
return defer.succeed([])

def delivered_txn(self, transaction_id, destination, code, response_dict):
"""Persists the response for an outgoing transaction.
Args:
transaction_id (str)
destination (str)
code (int)
response_json (str)
"""
pass

@defer.inlineCallbacks
def get_destination_retry_timings(self, destination):
"""Gets the current retry timings (if any) for a given destination.
Expand Down

0 comments on commit a6a776f

Please sign in to comment.