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 #3805 from matrix-org/erikj/limit_transaction_pdus…
Browse files Browse the repository at this point in the history
…_edus

Limit the number of PDUs/EDUs per fedreation transaction
  • Loading branch information
hawkowl authored Sep 6, 2018
2 parents 1d371fc + b07a2cb commit 654324e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/3805.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Limit the number of PDUs/EDUs per federation transaction
12 changes: 12 additions & 0 deletions synapse/federation/transaction_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,19 @@ def _transaction_transmission_loop(self, destination):
# 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(
Expand Down

0 comments on commit 654324e

Please sign in to comment.