summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2023-05-17 21:57:13 -0500
committerEric Eastwood <contact@ericeastwood.com>2023-05-17 21:57:13 -0500
commit3d80449d6b14065384584983ec61687ad922e1bc (patch)
tree30feb26888856aa8324560dcf39e76bf7c317ef6
parentFix lints (diff)
downloadsynapse-3d80449d6b14065384584983ec61687ad922e1bc.tar.xz
Fix empty case
-rw-r--r--synapse/storage/databases/state/bg_updates.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/storage/databases/state/bg_updates.py b/synapse/storage/databases/state/bg_updates.py
index 9be343a60f..05bce339e8 100644
--- a/synapse/storage/databases/state/bg_updates.py
+++ b/synapse/storage/databases/state/bg_updates.py
@@ -210,7 +210,9 @@ class StateGroupBackgroundUpdateStore(SQLBaseStore):
                 state_groups_we_have_already_fetched_string = ", ".join(
                     [
                         f"{state_group}::bigint"
-                        for state_group in state_groups_we_have_already_fetched
+                        # We default to `[-1]` just to fill in the query with something
+                        # that will have no effct
+                        for state_group in state_groups_we_have_already_fetched or [-1]
                     ]
                 )
 
@@ -230,7 +232,7 @@ class StateGroupBackgroundUpdateStore(SQLBaseStore):
                     key = (intern_string(typ), intern_string(state_key))
                     partial_state_map_for_state_group[key] = event_id
 
-                    if state_group < min_state_group or min_state_group is None:
+                    if min_state_group is None or state_group < min_state_group:
                         min_state_group = state_group
 
                 # If we see a state group edge link to a previous state_group that we