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
69018acb
Unverified
Commit
69018acb
authored
3 years ago
by
Richard van der Hoff
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Clear the resync bit after resyncing device lists (#9867)
Fixes #9866.
parent
294c6750
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changelog.d/9867.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/9867.bugfix
synapse/handlers/device.py
+7
-0
7 additions, 0 deletions
synapse/handlers/device.py
synapse/storage/databases/main/devices.py
+9
-10
9 additions, 10 deletions
synapse/storage/databases/main/devices.py
with
17 additions
and
10 deletions
changelog.d/9867.bugfix
0 → 100644
+
1
−
0
View file @
69018acb
Fix a bug which could cause Synapse to get stuck in a loop of resyncing device lists.
This diff is collapsed.
Click to expand it.
synapse/handlers/device.py
+
7
−
0
View file @
69018acb
...
...
@@ -925,6 +925,10 @@ class DeviceListUpdater:
else
:
cached_devices
=
await
self
.
store
.
get_cached_devices_for_user
(
user_id
)
if
cached_devices
==
{
d
[
"
device_id
"
]:
d
for
d
in
devices
}:
logging
.
info
(
"
Skipping device list resync for %s, as our cache matches already
"
,
user_id
,
)
devices
=
[]
ignore_devices
=
True
...
...
@@ -940,6 +944,9 @@ class DeviceListUpdater:
await
self
.
store
.
update_remote_device_list_cache
(
user_id
,
devices
,
stream_id
)
# mark the cache as valid, whether or not we actually processed any device
# list updates.
await
self
.
store
.
mark_remote_user_device_cache_as_valid
(
user_id
)
device_ids
=
[
device
[
"
device_id
"
]
for
device
in
devices
]
# Handle cross-signing keys.
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/databases/main/devices.py
+
9
−
10
View file @
69018acb
...
...
@@ -717,7 +717,15 @@ class DeviceWorkerStore(SQLBaseStore):
keyvalues
=
{
"
user_id
"
:
user_id
},
values
=
{},
insertion_values
=
{
"
added_ts
"
:
self
.
_clock
.
time_msec
()},
desc
=
"
make_remote_user_device_cache_as_stale
"
,
desc
=
"
mark_remote_user_device_cache_as_stale
"
,
)
async
def
mark_remote_user_device_cache_as_valid
(
self
,
user_id
:
str
)
->
None
:
# Remove the database entry that says we need to resync devices, after a resync
await
self
.
db_pool
.
simple_delete
(
table
=
"
device_lists_remote_resync
"
,
keyvalues
=
{
"
user_id
"
:
user_id
},
desc
=
"
mark_remote_user_device_cache_as_valid
"
,
)
async
def
mark_remote_user_device_list_as_unsubscribed
(
self
,
user_id
:
str
)
->
None
:
...
...
@@ -1289,15 +1297,6 @@ class DeviceStore(DeviceWorkerStore, DeviceBackgroundUpdateStore):
lock
=
False
,
)
# If we're replacing the remote user's device list cache presumably
# we've done a full resync, so we remove the entry that says we need
# to resync
self
.
db_pool
.
simple_delete_txn
(
txn
,
table
=
"
device_lists_remote_resync
"
,
keyvalues
=
{
"
user_id
"
:
user_id
},
)
async
def
add_device_change_to_streams
(
self
,
user_id
:
str
,
device_ids
:
Collection
[
str
],
hosts
:
List
[
str
]
):
...
...
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