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

Commit

Permalink
Resync stale devices in background
Browse files Browse the repository at this point in the history
This is so we don't block responding to federation transaction while we
try and fetch the device lists.
  • Loading branch information
erikjohnston committed Jul 21, 2023
1 parent fc1e534 commit 57383d4
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit 57383d4

Please sign in to comment.