Rename transaction queue functions to send_*

This commit is contained in:
Erik Johnston 2016-11-16 11:32:16 +00:00
parent dc6cede78e
commit 0e830d3770
2 changed files with 12 additions and 12 deletions

View File

@ -111,19 +111,19 @@ class FederationClient(FederationBase):
sent_pdus_destination_dist.inc_by(len(destinations)) sent_pdus_destination_dist.inc_by(len(destinations))
logger.debug("[%s] transaction_layer.enqueue_pdu... ", pdu.event_id) logger.debug("[%s] transaction_layer.send_pdu... ", pdu.event_id)
# TODO, add errback, etc. # TODO, add errback, etc.
self._transaction_queue.enqueue_pdu(pdu, destinations, order) self._transaction_queue.send_pdu(pdu, destinations, order)
logger.debug( logger.debug(
"[%s] transaction_layer.enqueue_pdu... done", "[%s] transaction_layer.send_pdu... done",
pdu.event_id pdu.event_id
) )
def send_presence(self, destination, states): def send_presence(self, destination, states):
if destination != self.server_name: if destination != self.server_name:
self._transaction_queue.enqueue_presence(destination, states) self._transaction_queue.send_presence(destination, states)
@log_function @log_function
def send_edu(self, destination, edu_type, content, key=None): def send_edu(self, destination, edu_type, content, key=None):
@ -136,17 +136,17 @@ class FederationClient(FederationBase):
sent_edus_counter.inc() sent_edus_counter.inc()
self._transaction_queue.enqueue_edu(edu, key=key) self._transaction_queue.send_edu(edu, key=key)
@log_function @log_function
def send_device_messages(self, destination): def send_device_messages(self, destination):
"""Sends the device messages in the local database to the remote """Sends the device messages in the local database to the remote
destination""" destination"""
self._transaction_queue.enqueue_device_messages(destination) self._transaction_queue.send_device_messages(destination)
@log_function @log_function
def send_failure(self, failure, destination): def send_failure(self, failure, destination):
self._transaction_queue.enqueue_failure(failure, destination) self._transaction_queue.send_failure(failure, destination)
return defer.succeed(None) return defer.succeed(None)
@log_function @log_function

View File

@ -115,7 +115,7 @@ class TransactionQueue(object):
else: else:
return not destination.startswith("localhost") return not destination.startswith("localhost")
def enqueue_pdu(self, pdu, destinations, order): def send_pdu(self, pdu, destinations, order):
# We loop through all destinations to see whether we already have # We loop through all destinations to see whether we already have
# a transaction in progress. If we do, stick it in the pending_pdus # a transaction in progress. If we do, stick it in the pending_pdus
# table and we'll get back to it later. # table and we'll get back to it later.
@ -139,7 +139,7 @@ class TransactionQueue(object):
self._attempt_new_transaction, destination self._attempt_new_transaction, destination
) )
def enqueue_presence(self, destination, states): def send_presence(self, destination, states):
self.pending_presence_by_dest.setdefault(destination, {}).update({ self.pending_presence_by_dest.setdefault(destination, {}).update({
state.user_id: state for state in states state.user_id: state for state in states
}) })
@ -148,7 +148,7 @@ class TransactionQueue(object):
self._attempt_new_transaction, destination self._attempt_new_transaction, destination
) )
def enqueue_edu(self, edu, key=None): def send_edu(self, edu, key=None):
destination = edu.destination destination = edu.destination
if not self.can_send_to(destination): if not self.can_send_to(destination):
@ -165,7 +165,7 @@ class TransactionQueue(object):
self._attempt_new_transaction, destination self._attempt_new_transaction, destination
) )
def enqueue_failure(self, failure, destination): def send_failure(self, failure, destination):
if destination == self.server_name or destination == "localhost": if destination == self.server_name or destination == "localhost":
return return
@ -180,7 +180,7 @@ class TransactionQueue(object):
self._attempt_new_transaction, destination self._attempt_new_transaction, destination
) )
def enqueue_device_messages(self, destination): def send_device_messages(self, destination):
if destination == self.server_name or destination == "localhost": if destination == self.server_name or destination == "localhost":
return return