Merge pull request #5418 from matrix-org/erikj/fix_send_fed_with_limit_zero

Fix bug sending federation transactions with lots of EDUs
This commit is contained in:
Erik Johnston 2019-06-10 20:19:49 +01:00 committed by GitHub
commit 78e74ab8a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

1
changelog.d/5418.bugfix Normal file
View File

@ -0,0 +1 @@
Fix bug where attempting to send transactions with large number of EDUs can fail.

View File

@ -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"