Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
6451fcd0
Commit
6451fcd0
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Create a new stream_id per presence update
parent
13f86c34
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/storage/presence.py
+9
-6
9 additions, 6 deletions
synapse/storage/presence.py
with
9 additions
and
6 deletions
synapse/storage/presence.py
+
9
−
6
View file @
6451fcd0
...
...
@@ -58,17 +58,20 @@ class UserPresenceState(namedtuple("UserPresenceState",
class
PresenceStore
(
SQLBaseStore
):
@defer.inlineCallbacks
def
update_presence
(
self
,
presence_states
):
stream_id_manager
=
yield
self
.
_presence_id_gen
.
get_next
(
self
)
with
stream_id_manager
as
stream_id
:
stream_ordering_manager
=
yield
self
.
_presence_id_gen
.
get_next_mult
(
self
,
len
(
presence_states
)
)
with
stream_ordering_manager
as
stream_orderings
:
yield
self
.
runInteraction
(
"
update_presence
"
,
self
.
_update_presence_txn
,
stream_
id
,
presence_states
,
self
.
_update_presence_txn
,
stream_
orderings
,
presence_states
,
)
defer
.
returnValue
((
stream_
id
,
self
.
_presence_id_gen
.
get_max_token
()))
defer
.
returnValue
((
stream_
orderings
[
-
1
]
,
self
.
_presence_id_gen
.
get_max_token
()))
def
_update_presence_txn
(
self
,
txn
,
stream_
id
,
presence_states
):
for
st
ate
in
presence_states
:
def
_update_presence_txn
(
self
,
txn
,
stream_
orderings
,
presence_states
):
for
st
ream_id
,
state
in
zip
(
stream_orderings
,
presence_states
)
:
txn
.
call_after
(
self
.
presence_stream_cache
.
entity_has_changed
,
state
.
user_id
,
stream_id
,
...
...
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