summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--synapse/storage/state.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index 45afd42b3f..947d3fc177 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -1266,9 +1266,8 @@ class StateGroupWorkerStore(EventsWorkerStore, SQLBaseStore):
                 current_search = next_to_search
                 next_to_search = set()
             else:
-                lst = list(next_to_search)
-                current_search = set(lst[:100])
-                next_to_search = set(lst[100:])
+                current_search = set(islice(next_to_search, 100))
+                next_to_search -= current_search
 
             # Check if state groups are referenced
             sql = """