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

Commit

Permalink
Merge branch 'matrix-org:develop' into fix-update-rehydrated-device-r…
Browse files Browse the repository at this point in the history
…efresh-tokens
  • Loading branch information
hanadi92 authored Sep 11, 2023
2 parents 461b805 + 151e4bb commit 7f2e939
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 37 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions changelog.d/16298.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't try refetching device lists for users on remote hosts that are marked as "down".
68 changes: 34 additions & 34 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion synapse/handlers/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@
from synapse.util.caches.expiringcache import ExpiringCache
from synapse.util.cancellation import cancellable
from synapse.util.metrics import measure_func
from synapse.util.retryutils import NotRetryingDestination
from synapse.util.retryutils import (
NotRetryingDestination,
filter_destinations_by_retry_limiter,
)

if TYPE_CHECKING:
from synapse.server import HomeServer
Expand Down Expand Up @@ -1270,8 +1273,18 @@ async def _maybe_retry_device_resync(self) -> None:
self._resync_retry_in_progress = True
# Get all of the users that need resyncing.
need_resync = await self.store.get_user_ids_requiring_device_list_resync()

# Filter out users whose host is marked as "down" up front.
hosts = await filter_destinations_by_retry_limiter(
{get_domain_from_id(u) for u in need_resync}, self.clock, self.store
)
hosts = set(hosts)

# Iterate over the set of user IDs.
for user_id in need_resync:
if get_domain_from_id(user_id) not in hosts:
continue

try:
# Try to resync the current user's devices list.
result = (await self.multi_user_device_resync([user_id], False))[
Expand Down

0 comments on commit 7f2e939

Please sign in to comment.