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

Commit c968dc3

Browse files
erikjohnstonFizzadar
authored andcommitted
Resync stale devices in background (matrix-org#15975)
This is so we don't block responding to federation transaction while we try and fetch the device lists.
1 parent 54651f0 commit c968dc3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

changelog.d/15975.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix bug where resyncing stale device lists could block responding to federation transactions, and thus delay receiving new data from the remote server.

synapse/handlers/device.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,14 @@ async def _handle_device_updates(self, user_id: str) -> None:
11241124
)
11251125

11261126
if resync:
1127-
await self.multi_user_device_resync([user_id])
1127+
# We mark as stale up front in case we get restarted.
1128+
await self.store.mark_remote_users_device_caches_as_stale([user_id])
1129+
run_as_background_process(
1130+
"_maybe_retry_device_resync",
1131+
self.multi_user_device_resync,
1132+
[user_id],
1133+
False,
1134+
)
11281135
else:
11291136
# Simply update the single device, since we know that is the only
11301137
# change (because of the single prev_id matching the current cache)

0 commit comments

Comments
 (0)