summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-06-10 16:21:42 +0100
committerErik Johnston <erik@matrix.org>2019-06-10 16:22:45 +0100
commitc413540fb9e4b6ee2ec975a98676ea56d12249c8 (patch)
tree7853d4b947451c9708cba12ed1ff722ea31cdbea /synapse
parentMerge branch 'erikj/fix_null_valid_until_ms' of github.com:matrix-org/synapse... (diff)
downloadsynapse-c413540fb9e4b6ee2ec975a98676ea56d12249c8.tar.xz
Fix bug sending federation transactions with lots of EDUs
If we try and send a transaction with lots of EDUs and we run out of
space, we call get_new_device_msgs_for_remote with a limit of 0, which
then failed.
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/deviceinbox.py4
1 files changed, 4 insertions, 0 deletions
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"