diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2018-09-07 01:33:31 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-07 01:33:31 +1000 |
commit | 654324eded914eb85df8727d1a4a91031800f902 (patch) | |
tree | 66954852ff85607349d784e658f39ed94839ef29 | |
parent | Merge pull request #3806 from matrix-org/erikj/limit_postgres_travis (diff) | |
parent | Spelling (diff) | |
download | synapse-654324eded914eb85df8727d1a4a91031800f902.tar.xz |
Merge pull request #3805 from matrix-org/erikj/limit_transaction_pdus_edus
Limit the number of PDUs/EDUs per fedreation transaction
-rw-r--r-- | changelog.d/3805.misc | 1 | ||||
-rw-r--r-- | synapse/federation/transaction_queue.py | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/changelog.d/3805.misc b/changelog.d/3805.misc new file mode 100644 index 0000000000..257feeb071 --- /dev/null +++ b/changelog.d/3805.misc @@ -0,0 +1 @@ +Limit the number of PDUs/EDUs per federation transaction diff --git a/synapse/federation/transaction_queue.py b/synapse/federation/transaction_queue.py index 94d7423d01..8cbf8c4f7f 100644 --- a/synapse/federation/transaction_queue.py +++ b/synapse/federation/transaction_queue.py @@ -463,7 +463,19 @@ class TransactionQueue(object): # pending_transactions flag. 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:] + if leftover_pdus: + self.pending_pdus_by_dest[destination] = leftover_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_presence = self.pending_presence_by_dest.pop(destination, {}) pending_edus.extend( |