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
Container Registry
Model registry
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
Maunium
synapse
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",
...
@@ -58,17 +58,20 @@ class UserPresenceState(namedtuple("UserPresenceState",
class
PresenceStore
(
SQLBaseStore
):
class
PresenceStore
(
SQLBaseStore
):
@defer.inlineCallbacks
@defer.inlineCallbacks
def
update_presence
(
self
,
presence_states
):
def
update_presence
(
self
,
presence_states
):
stream_id_manager
=
yield
self
.
_presence_id_gen
.
get_next
(
self
)
stream_ordering_manager
=
yield
self
.
_presence_id_gen
.
get_next_mult
(
with
stream_id_manager
as
stream_id
:
self
,
len
(
presence_states
)
)
with
stream_ordering_manager
as
stream_orderings
:
yield
self
.
runInteraction
(
yield
self
.
runInteraction
(
"
update_presence
"
,
"
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
):
def
_update_presence_txn
(
self
,
txn
,
stream_
orderings
,
presence_states
):
for
st
ate
in
presence_states
:
for
st
ream_id
,
state
in
zip
(
stream_orderings
,
presence_states
)
:
txn
.
call_after
(
txn
.
call_after
(
self
.
presence_stream_cache
.
entity_has_changed
,
self
.
presence_stream_cache
.
entity_has_changed
,
state
.
user_id
,
stream_id
,
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