summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-05-15 16:34:17 +0100
committerErik Johnston <erik@matrix.org>2015-05-15 16:34:17 +0100
commit70f272f71ca399205a72deb29b0f86ff3bf23618 (patch)
tree8485e498e3066f3a683a01b23f9b23b2cbb4ad5f /synapse/storage/events.py
parentDon't fetch prev_content for current_state (diff)
downloadsynapse-70f272f71ca399205a72deb29b0f86ff3bf23618.tar.xz
Don't completely drain the list
Diffstat (limited to '')
-rw-r--r--synapse/storage/events.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 066e1aab75..6ee2e9a485 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -505,8 +505,15 @@ class EventsStore(SQLBaseStore):
         while True:
             try:
                 with self._event_fetch_lock:
-                    event_list = self._event_fetch_list
-                    self._event_fetch_list = []
+                    tot = 0
+                    for j, lst in enumerate(self._event_fetch_list):
+                        if tot > 200:
+                            break
+                        tot += len(lst[0])
+
+                    event_list = self._event_fetch_list[:j+1]
+                    self._event_fetch_list = self._event_fetch_list[j+1:]
+
                     if not event_list:
                         if self.database_engine.single_threaded or i > 3:
                             self._event_fetch_ongoing -= 1