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

Remove legacy code of single user device resync api #15418

Merged
merged 10 commits into from Apr 21, 2023
1 change: 1 addition & 0 deletions changelog.d/15418.removal
@@ -0,0 +1 @@
Since multi-user device resync api is now available, single user counterpart is removed.
akstron marked this conversation as resolved.
Show resolved Hide resolved
18 changes: 2 additions & 16 deletions synapse/handlers/device.py
Expand Up @@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
from http import HTTPStatus
from typing import (
TYPE_CHECKING,
Any,
Expand Down Expand Up @@ -919,12 +918,8 @@ class DeviceListWorkerUpdater:
def __init__(self, hs: "HomeServer"):
from synapse.replication.http.devices import (
ReplicationMultiUserDevicesResyncRestServlet,
ReplicationUserDevicesResyncRestServlet,
)

self._user_device_resync_client = (
ReplicationUserDevicesResyncRestServlet.make_client(hs)
)
self._multi_user_device_resync_client = (
ReplicationMultiUserDevicesResyncRestServlet.make_client(hs)
)
Expand All @@ -948,17 +943,8 @@ async def multi_user_device_resync(

try:
return await self._multi_user_device_resync_client(user_ids=user_ids)
except SynapseError as err:
if not (
err.code == HTTPStatus.NOT_FOUND and err.errcode == Codes.UNRECOGNIZED
):
raise

# Fall back to single requests
result: Dict[str, Optional[JsonDict]] = {}
for user_id in user_ids:
result[user_id] = await self._user_device_resync_client(user_id=user_id)
return result
except:
raise

async def user_device_resync(
self, user_id: str, mark_failed_as_stale: bool = True
Expand Down