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
3655585e
Unverified
Commit
3655585e
authored
3 years ago
by
Andrew Morgan
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add a docstring to `add_device_change_to_streams` and fix some nearby types (#11912)
parent
0640f8eb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/11912.misc
+1
-0
1 addition, 0 deletions
changelog.d/11912.misc
synapse/storage/databases/main/devices.py
+16
-6
16 additions, 6 deletions
synapse/storage/databases/main/devices.py
with
17 additions
and
6 deletions
changelog.d/11912.misc
0 → 100644
+
1
−
0
View file @
3655585e
Various refactors to the application service notifier code.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
synapse/storage/databases/main/devices.py
+
16
−
6
View file @
3655585e
...
...
@@ -1496,13 +1496,23 @@ class DeviceStore(DeviceWorkerStore, DeviceBackgroundUpdateStore):
)
async
def
add_device_change_to_streams
(
self
,
user_id
:
str
,
device_ids
:
Collection
[
str
],
hosts
:
List
[
str
]
)
->
int
:
self
,
user_id
:
str
,
device_ids
:
Collection
[
str
],
hosts
:
Collection
[
str
]
)
->
Optional
[
int
]
:
"""
Persist that a user
'
s devices have been updated, and which hosts
(if any) should be poked.
Args:
user_id: The ID of the user whose device changed.
device_ids: The IDs of any changed devices. If empty, this function will
return None.
hosts: The remote destinations that should be notified of the change.
Returns:
The maximum stream ID of device list updates that were added to the database, or
None if no updates were added.
"""
if
not
device_ids
:
return
return
None
async
with
self
.
_device_list_id_gen
.
get_next_mult
(
len
(
device_ids
)
...
...
@@ -1573,11 +1583,11 @@ class DeviceStore(DeviceWorkerStore, DeviceBackgroundUpdateStore):
self
,
txn
:
LoggingTransaction
,
user_id
:
str
,
device_ids
:
Collection
[
str
],
hosts
:
List
[
str
],
device_ids
:
Iterable
[
str
],
hosts
:
Collection
[
str
],
stream_ids
:
List
[
str
],
context
:
Dict
[
str
,
str
],
):
)
->
None
:
for
host
in
hosts
:
txn
.
call_after
(
self
.
_device_list_federation_stream_cache
.
entity_has_changed
,
...
...
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