Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
04196a4d
Unverified
Commit
04196a4d
authored
5 years ago
by
Erik Johnston
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #5507 from matrix-org/erikj/presence_sync_tighloop
Fix sync tightloop bug.
parents
f40a7dc4
915280f1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/5507.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/5507.bugfix
synapse/handlers/presence.py
+19
-2
19 additions, 2 deletions
synapse/handlers/presence.py
with
20 additions
and
2 deletions
changelog.d/5507.bugfix
0 → 100644
+
1
−
0
View file @
04196a4d
Fix bug where clients could tight loop calling `/sync` for a period.
This diff is collapsed.
Click to expand it.
synapse/handlers/presence.py
+
19
−
2
View file @
04196a4d
...
...
@@ -1017,11 +1017,28 @@ class PresenceEventSource(object):
if
from_key
is
not
None
:
from_key
=
int
(
from_key
)
max_token
=
self
.
store
.
get_current_presence_token
()
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 (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
()
stream_change_cache
=
self
.
store
.
presence_stream_cache
max_token
=
self
.
store
.
get_current_presence_token
()
users_interested_in
=
yield
self
.
_get_interested_in
(
user
,
explicit_room_id
)
user_ids_changed
=
set
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment