diff options
author | Shay <hillerys@element.io> | 2023-08-22 07:15:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-22 14:15:34 +0000 |
commit | 69048f7b4848ab6a4ae6cb233f8cbf36d73c0ba1 (patch) | |
tree | 36358213ec30b624ac550e77c9df7f318776676e /synapse/storage/databases/main/devices.py | |
parent | Bump serde from 1.0.183 to 1.0.184 (#16139) (diff) | |
download | synapse-69048f7b4848ab6a4ae6cb233f8cbf36d73c0ba1.tar.xz |
Add an admin endpoint to allow authorizing server to signal token revocations (#16125)
Diffstat (limited to 'synapse/storage/databases/main/devices.py')
-rw-r--r-- | synapse/storage/databases/main/devices.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/storage/databases/main/devices.py b/synapse/storage/databases/main/devices.py index e4162f846b..fa69a4a298 100644 --- a/synapse/storage/databases/main/devices.py +++ b/synapse/storage/databases/main/devices.py @@ -33,6 +33,7 @@ from typing_extensions import Literal from synapse.api.constants import EduTypes from synapse.api.errors import Codes, StoreError +from synapse.config.homeserver import HomeServerConfig from synapse.logging.opentracing import ( get_active_span_text_map, set_tag, @@ -1663,6 +1664,7 @@ class DeviceStore(DeviceWorkerStore, DeviceBackgroundUpdateStore): self.device_id_exists_cache: LruCache[ Tuple[str, str], Literal[True] ] = LruCache(cache_name="device_id_exists", max_size=10000) + self.config: HomeServerConfig = hs.config async def store_device( self, @@ -1784,6 +1786,13 @@ class DeviceStore(DeviceWorkerStore, DeviceBackgroundUpdateStore): for device_id in device_ids: self.device_id_exists_cache.invalidate((user_id, device_id)) + # TODO: don't nuke the entire cache once there is a way to associate + # device_id -> introspection_token + if self.config.experimental.msc3861.enabled: + # mypy ignore - the token cache is defined on MSC3861DelegatedAuth + self.auth._token_cache.invalidate_all() # type: ignore[attr-defined] + await self.stream_introspection_token_invalidation((None,)) + async def update_device( self, user_id: str, device_id: str, new_display_name: Optional[str] = None ) -> None: |