summary refs log tree commit diff
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2021-12-20 17:01:31 +0000
committerOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2021-12-20 17:01:31 +0000
commit3bf7d6457c4e031283bf9ca46d853f61f720ae75 (patch)
tree601271b5ad6023f3299cf1ded96b864a622da6c7
parentBypass caching from the old system (diff)
downloadsynapse-rei/librepush.net-stcache.tar.xz
-rw-r--r--synapse/storage/databases/state/store.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/synapse/storage/databases/state/store.py b/synapse/storage/databases/state/store.py
index 7749426a87..afb7a52cf8 100644
--- a/synapse/storage/databases/state/store.py
+++ b/synapse/storage/databases/state/store.py
@@ -453,12 +453,22 @@ class StateGroupDataStore(StateBackgroundUpdateStore, SQLBaseStore):
             )
 
         log_ticker += 1
-        validation_logger.info(
-            "LT=%d. Correct: %r. Effective: %r",
-            log_ticker,
-            validation_counter,
-            effectiveness_counter,
-        )
+        if log_ticker % 20 == 0:
+            validation_logger.info(
+                "LT=%d. Correct: %r. Effective: %r",
+                log_ticker,
+                validation_counter,
+                effectiveness_counter,
+            )
+
+        if len(set(groups)) != len(groups):
+            try:
+                raise RuntimeError("Inefficient")
+            except RuntimeError:
+                validation_logger.exception(
+                    "Warning (not of bug, but fishy): len(s(g)) != len(g). g=%r.",
+                    groups,
+                )
 
         return old_result
 
@@ -543,7 +553,7 @@ class StateGroupDataStore(StateBackgroundUpdateStore, SQLBaseStore):
         # (member_state, incomplete_groups_m,) = self._get_state_for_groups_using_cache(
         #     groups, self._state_group_members_cache, state_filter=member_filter
         # )
-        state = dict()
+        state = {}
         # state = dict(non_member_state)
         # for group in groups:
         #     state[group].update(member_state[group])