Resync stale devices in background (#15975)
This is so we don't block responding to federation transaction while we try and fetch the device lists.
This commit is contained in:
parent
4a711bf379
commit
654902a758
|
@ -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.
|
|
@ -1124,7 +1124,14 @@ class DeviceListUpdater(DeviceListWorkerUpdater):
|
||||||
)
|
)
|
||||||
|
|
||||||
if resync:
|
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:
|
else:
|
||||||
# Simply update the single device, since we know that is the only
|
# Simply update the single device, since we know that is the only
|
||||||
# change (because of the single prev_id matching the current cache)
|
# change (because of the single prev_id matching the current cache)
|
||||||
|
|
Loading…
Reference in New Issue