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

Commit

Permalink
Merge pull request #4855 from matrix-org/rav/refactor_transaction_queue
Browse files Browse the repository at this point in the history
Split TransactionQueue up
  • Loading branch information
richvdh authored Mar 15, 2019
2 parents 2dee441 + ec3a59d commit 3b7ceb2
Show file tree
Hide file tree
Showing 8 changed files with 865 additions and 761 deletions.
1 change: 1 addition & 0 deletions changelog.d/4855.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Refactor federation TransactionQueue.
14 changes: 7 additions & 7 deletions synapse/federation/send_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@


class FederationRemoteSendQueue(object):
"""A drop in replacement for TransactionQueue"""
"""A drop in replacement for FederationSender"""

def __init__(self, hs):
self.server_name = hs.hostname
Expand Down Expand Up @@ -154,13 +154,13 @@ def _clear_queue_before_pos(self, position_to_delete):
del self.device_messages[key]

def notify_new_events(self, current_id):
"""As per TransactionQueue"""
"""As per FederationSender"""
# We don't need to replicate this as it gets sent down a different
# stream.
pass

def build_and_send_edu(self, destination, edu_type, content, key=None):
"""As per TransactionQueue"""
"""As per FederationSender"""
if destination == self.server_name:
logger.info("Not sending EDU to ourselves")
return
Expand All @@ -184,7 +184,7 @@ def build_and_send_edu(self, destination, edu_type, content, key=None):
self.notifier.on_new_replication_data()

def send_read_receipt(self, receipt):
"""As per TransactionQueue
"""As per FederationSender
Args:
receipt (synapse.types.ReadReceipt):
Expand All @@ -193,7 +193,7 @@ def send_read_receipt(self, receipt):
pass

def send_presence(self, states):
"""As per TransactionQueue
"""As per FederationSender
Args:
states (list(UserPresenceState))
Expand All @@ -210,7 +210,7 @@ def send_presence(self, states):
self.notifier.on_new_replication_data()

def send_device_messages(self, destination):
"""As per TransactionQueue"""
"""As per FederationSender"""
pos = self._next_pos()
self.device_messages[pos] = destination
self.notifier.on_new_replication_data()
Expand Down Expand Up @@ -448,7 +448,7 @@ def process_rows_for_federation(transaction_queue, rows):
transaction queue ready for sending to the relevant homeservers.
Args:
transaction_queue (TransactionQueue)
transaction_queue (FederationSender)
rows (list(synapse.replication.tcp.streams.FederationStreamRow))
"""

Expand Down
Loading

0 comments on commit 3b7ceb2

Please sign in to comment.