Merge commit 'f1245dc3c' into anoa/dinsic_release_1_18_x
* commit 'f1245dc3c': Fix resync remote devices on receive PDU in worker mode. (#7815)
This commit is contained in:
1
changelog.d/7815.bugfix
Normal file
1
changelog.d/7815.bugfix
Normal file
@@ -0,0 +1 @@
|
||||
Fix detection of out of sync remote device lists when receiving events from remote users.
|
||||
@@ -61,6 +61,7 @@ from synapse.logging.context import (
|
||||
run_in_background,
|
||||
)
|
||||
from synapse.logging.utils import log_function
|
||||
from synapse.metrics.background_process_metrics import run_as_background_process
|
||||
from synapse.replication.http.devices import ReplicationUserDevicesResyncRestServlet
|
||||
from synapse.replication.http.federation import (
|
||||
ReplicationCleanRoomRestServlet,
|
||||
@@ -792,15 +793,25 @@ class FederationHandler(BaseHandler):
|
||||
resync = True
|
||||
|
||||
if resync:
|
||||
await self.store.mark_remote_user_device_cache_as_stale(event.sender)
|
||||
run_as_background_process(
|
||||
"resync_device_due_to_pdu", self._resync_device, event.sender
|
||||
)
|
||||
|
||||
# Immediately attempt a resync in the background
|
||||
if self.config.worker_app:
|
||||
return run_in_background(self._user_device_resync, event.sender)
|
||||
else:
|
||||
return run_in_background(
|
||||
self._device_list_updater.user_device_resync, event.sender
|
||||
)
|
||||
async def _resync_device(self, sender: str) -> None:
|
||||
"""We have detected that the device list for the given user may be out
|
||||
of sync, so we try and resync them.
|
||||
"""
|
||||
|
||||
try:
|
||||
await self.store.mark_remote_user_device_cache_as_stale(sender)
|
||||
|
||||
# Immediately attempt a resync in the background
|
||||
if self.config.worker_app:
|
||||
await self._user_device_resync(user_id=sender)
|
||||
else:
|
||||
await self._device_list_updater.user_device_resync(sender)
|
||||
except Exception:
|
||||
logger.exception("Failed to resync device for %s", sender)
|
||||
|
||||
@log_function
|
||||
async def backfill(self, dest, room_id, limit, extremities):
|
||||
|
||||
Reference in New Issue
Block a user