From eca7ece93f419f8381d63d44d0b605f2f7cf25dc Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 29 Nov 2018 15:50:04 +0000 Subject: Handle slow/lossy connections better when sending transactions --- synapse/federation/transaction_queue.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'synapse/federation/transaction_queue.py') diff --git a/synapse/federation/transaction_queue.py b/synapse/federation/transaction_queue.py index a4e760f935..2f70a148e9 100644 --- a/synapse/federation/transaction_queue.py +++ b/synapse/federation/transaction_queue.py @@ -455,16 +455,22 @@ class TransactionQueue(object): pending_pdus = self.pending_pdus_by_dest.pop(destination, []) # We can only include at most 50 PDUs per transactions - pending_pdus, leftover_pdus = pending_pdus[:50], pending_pdus[50:] + pending_pdus, leftover_pdus = pending_pdus[-5:], pending_pdus[:-5] if leftover_pdus: - self.pending_pdus_by_dest[destination] = leftover_pdus + # self.pending_pdus_by_dest[destination] = leftover_pdus + for _, _, p_span in leftover_pdus: + p_span.set_tag("success", False) + p_span.log_kv({"result": "dropped"}) + p_span.finish() + + logger.info("TX [%s] Sending PDUs: %s", destination, pending_pdus) pending_edus = self.pending_edus_by_dest.pop(destination, []) # We can only include at most 100 EDUs per transactions - pending_edus, leftover_edus = pending_edus[:100], pending_edus[100:] - if leftover_edus: - self.pending_edus_by_dest[destination] = leftover_edus + pending_edus, leftover_edus = pending_edus[-5:], pending_edus[:-5] + # if leftover_edus: + # self.pending_edus_by_dest[destination] = leftover_edus pending_presence = self.pending_presence_by_dest.pop(destination, {}) -- cgit 1.5.1