summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--synapse/storage/stream.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/storage/stream.py b/synapse/storage/stream.py
index 5062bf4e47..0d32a3a498 100644
--- a/synapse/storage/stream.py
+++ b/synapse/storage/stream.py
@@ -828,8 +828,8 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
 
             rows.extend(new_rows)
 
-        if limit > 0:
-            rows = rows[:limit]
+        # We may have inserted more rows than necessary in the loop above
+        rows = rows[:limit]
 
         if rows:
             chunk = rows[-1].chunk_id