Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Resync stale devices in background #15975

Merged
merged 2 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/15975.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where resyncing stale device lists could block responding to federation transactions, and thus delay receiving new data from the remote server.
9 changes: 8 additions & 1 deletion synapse/handlers/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,14 @@ async def _handle_device_updates(self, user_id: str) -> None:
)

if resync:
await self.multi_user_device_resync([user_id])
# We mark as stale up front in case we get restarted.
await self.store.mark_remote_users_device_caches_as_stale([user_id])
run_as_background_process(
"_maybe_retry_device_resync",
self.multi_user_device_resync,
[user_id],
False,
)
else:
# Simply update the single device, since we know that is the only
# change (because of the single prev_id matching the current cache)
Expand Down