summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-09-05 15:49:57 +0100
committerErik Johnston <erik@matrix.org>2016-09-05 15:49:57 +0100
commit0595413c0fe51d4f400f597bf57cd13d5e3450e3 (patch)
tree66bacf2e1a4f820a45cf3a1bba59a1cb28ce93dc /synapse/storage
parentCorrectly handle reindexing state groups that already have an edge (diff)
downloadsynapse-0595413c0fe51d4f400f597bf57cd13d5e3450e3.tar.xz
Scale the batch size so that we're not bitten by the minimum
Diffstat (limited to '')
-rw-r--r--synapse/storage/state.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index af3ddd962d..0730399b80 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -649,6 +649,10 @@ class StateStore(SQLBaseStore):
         rows_inserted = progress.get("rows_inserted", 0)
         max_group = progress.get("max_group", None)
 
+        BATCH_SIZE_SCALE_FACTOR = 100
+
+        batch_size = max(1, int(batch_size / BATCH_SIZE_SCALE_FACTOR))
+
         if max_group is None:
             rows = yield self._execute(
                 "_background_deduplicate_state", None,
@@ -779,4 +783,4 @@ class StateStore(SQLBaseStore):
         if finished:
             yield self._end_background_update(self.STATE_GROUP_DEDUPLICATION_UPDATE_NAME)
 
-        defer.returnValue(result)
+        defer.returnValue(result * BATCH_SIZE_SCALE_FACTOR)