summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-03-05 09:16:35 +0000
committerErik Johnston <erik@matrix.org>2019-03-05 09:16:35 +0000
commitaa06d26ae05585ddfb5e33a2dd521c9aa27b6cfa (patch)
treec7cf173e821717bf0208f03686c4632a0508a949
parentFix missing null guard (diff)
downloadsynapse-aa06d26ae05585ddfb5e33a2dd521c9aa27b6cfa.tar.xz
clarify comments
-rw-r--r--changelog.d/4699.bugfix2
-rw-r--r--synapse/handlers/federation.py19
-rw-r--r--synapse/visibility.py2
3 files changed, 13 insertions, 10 deletions
diff --git a/changelog.d/4699.bugfix b/changelog.d/4699.bugfix
index 8cd8340cc1..1d7f3174e7 100644
--- a/changelog.d/4699.bugfix
+++ b/changelog.d/4699.bugfix
@@ -1 +1 @@
-Fix attempting to paginate in rooms where server cannot see any events.
+Fix attempting to paginate in rooms where server cannot see any events, to avoid unnecessarily pulling in lots of redacted events.
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index bf2989aefd..72b63d64d0 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -862,9 +862,9 @@ class FederationHandler(BaseHandler):
         # as otherwise we'll just spend a lot of resources to get redacted
         # events.
         #
-        # We do this by filtering all the extremities and seeing if any remain.
-        # Given we don't have the extremity events themselves, we need to
-        # actually check the events that reference them.
+        # We do this by filtering all the backwards extremities and seeing if
+        # any remain. Given we don't have the extremity events themselves, we
+        # need to actually check the events that reference them.
         #
         # *Note*: the spec wants us to keep backfilling until we reach the start
         # of the room in case we are allowed to see some of the history. However
@@ -873,13 +873,16 @@ class FederationHandler(BaseHandler):
         # there is its often sufficiently long ago that clients would stop
         # attempting to paginate before backfill reached the visible history.
         #
-        # TODO: If we do do a backfill the we should filter the extremities to
-        #   only include those that point to visible portions of history.
+        # TODO: If we do do a backfill then we should filter the backwards
+        #   extremities to only include those that point to visible portions of
+        #   history.
         #
         # TODO: Correctly handle the case where we are allowed to see the
-        #   forward event but not the extremity, e.g. in the case of initial
-        #   join of the server where we are allowed to see the join event but
-        #   not anything before it.
+        #   forward event but not the backward extremity, e.g. in the case of
+        #   initial join of the server where we are allowed to see the join
+        #   event but not anything before it. This would require looking at the
+        #   state *before* the event, ignoring the special casing certain event
+        #   types have.
 
         forward_events = yield self.store.get_successor_events(
             list(extremities),
diff --git a/synapse/visibility.py b/synapse/visibility.py
index e9dc73c25e..efec21673b 100644
--- a/synapse/visibility.py
+++ b/synapse/visibility.py
@@ -277,7 +277,7 @@ def filter_events_for_server(store, server_name, events, redact=True,
 
         return True
 
-    # Next lets check to see if all the events have a history visibility
+    # Lets check to see if all the events have a history visibility
     # of "shared" or "world_readable". If thats the case then we don't
     # need to check membership (as we know the server is in the room).
     event_to_state_ids = yield store.get_state_ids_for_events(