summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-07-01 10:22:42 +0100
committerErik Johnston <erik@matrix.org>2019-07-01 10:22:42 +0100
commit915280f1edec3ddfe6261940d91ef451f207ed15 (patch)
treef8ac202b9e59fbf64f5fe66f3f0c4a5463db8651
parentNewsfile (diff)
downloadsynapse-915280f1edec3ddfe6261940d91ef451f207ed15.tar.xz
Fixup comment
-rw-r--r--synapse/handlers/presence.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py
index 3edd359985..c80dc2eba0 100644
--- a/synapse/handlers/presence.py
+++ b/synapse/handlers/presence.py
@@ -1021,12 +1021,19 @@ class PresenceEventSource(object):
             if from_key == max_token:
                 # This is necessary as due to the way stream ID generators work
                 # we may get updates that have a stream ID greater than the max
-                # token. This is usually fine, as it just means that we may send
-                # down some presence updates multiple times. However, we need to
-                # be careful that the sync stream actually does make some
-                # progress, otherwise clients will end up tight looping calling
-                # /sync due to it returning the same token repeatedly. Hence
-                # this guard. C.f. #5503.
+                # token (e.g. max_token is N but stream generator may return
+                # results for N+2, due to N+1 not having finished being
+                # persisted yet).
+                #
+                # This is usually fine, as it just means that we may send down
+                # some presence updates multiple times. However, we need to be
+                # careful that the sync stream either actually does make some
+                # progress or doesn't return, otherwise clients will end up
+                # tight looping calling /sync due to it immediately returning
+                # the same token repeatedly.
+                #
+                # Hence this guard where we just return nothing so that the sync
+                # doesn't return. C.f. #5503.
                 defer.returnValue(([], max_token))
 
             presence = self.get_presence_handler()