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

Commit 151e4bb

Browse files
authored
Filter out down hosts when retrying fetching device lists (#16298)
1 parent b0e93b6 commit 151e4bb

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

changelog.d/16298.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Don't try refetching device lists for users on remote hosts that are marked as "down".

synapse/handlers/device.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@
5858
from synapse.util.caches.expiringcache import ExpiringCache
5959
from synapse.util.cancellation import cancellable
6060
from synapse.util.metrics import measure_func
61-
from synapse.util.retryutils import NotRetryingDestination
61+
from synapse.util.retryutils import (
62+
NotRetryingDestination,
63+
filter_destinations_by_retry_limiter,
64+
)
6265

6366
if TYPE_CHECKING:
6467
from synapse.server import HomeServer
@@ -1269,8 +1272,18 @@ async def _maybe_retry_device_resync(self) -> None:
12691272
self._resync_retry_in_progress = True
12701273
# Get all of the users that need resyncing.
12711274
need_resync = await self.store.get_user_ids_requiring_device_list_resync()
1275+
1276+
# Filter out users whose host is marked as "down" up front.
1277+
hosts = await filter_destinations_by_retry_limiter(
1278+
{get_domain_from_id(u) for u in need_resync}, self.clock, self.store
1279+
)
1280+
hosts = set(hosts)
1281+
12721282
# Iterate over the set of user IDs.
12731283
for user_id in need_resync:
1284+
if get_domain_from_id(user_id) not in hosts:
1285+
continue
1286+
12741287
try:
12751288
# Try to resync the current user's devices list.
12761289
result = (await self.multi_user_device_resync([user_id], False))[

0 commit comments

Comments
 (0)