summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2019-06-10 20:19:49 +0100
committerGitHub <noreply@github.com>2019-06-10 20:19:49 +0100
commit78e74ab8a1e0ab7938a4f221b20fa1fa04dc5523 (patch)
tree4846bb1461e8442b516728be5e1913f49018c63f
parent1.0.0rc2 (diff)
parentUpdate changelog.d/5418.bugfix (diff)
downloadsynapse-78e74ab8a1e0ab7938a4f221b20fa1fa04dc5523.tar.xz
Merge pull request #5418 from matrix-org/erikj/fix_send_fed_with_limit_zero
Fix bug sending federation transactions with lots of EDUs
-rw-r--r--changelog.d/5418.bugfix1
-rw-r--r--synapse/storage/deviceinbox.py4
2 files changed, 5 insertions, 0 deletions
diff --git a/changelog.d/5418.bugfix b/changelog.d/5418.bugfix
new file mode 100644
index 0000000000..3fd4d2a882
--- /dev/null
+++ b/changelog.d/5418.bugfix
@@ -0,0 +1 @@
+Fix bug where attempting to send transactions with large number of EDUs can fail.
diff --git a/synapse/storage/deviceinbox.py b/synapse/storage/deviceinbox.py
index 9b0a99cb49..4ea0deea4f 100644
--- a/synapse/storage/deviceinbox.py
+++ b/synapse/storage/deviceinbox.py
@@ -138,6 +138,10 @@ class DeviceInboxWorkerStore(SQLBaseStore):
         if not has_changed or last_stream_id == current_stream_id:
             return defer.succeed(([], current_stream_id))
 
+        if limit <= 0:
+            # This can happen if we run out of room for EDUs in the transaction.
+            return defer.succeed(([], last_stream_id))
+
         def get_new_messages_for_remote_destination_txn(txn):
             sql = (
                 "SELECT stream_id, messages_json FROM device_federation_outbox"