diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-04-06 08:58:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-06 08:58:18 -0400 |
commit | 44bb881096d7ad4d730e2dc31e0094c0324e0970 (patch) | |
tree | e5fdb161168dba08ec4f800ed5f0d44eb8a552cd /synapse/handlers/sync.py | |
parent | Fix reported bugbear: too broad exception assertion (#9753) (diff) | |
download | synapse-44bb881096d7ad4d730e2dc31e0094c0324e0970.tar.xz |
Add type hints to expiring cache. (#9730)
Diffstat (limited to 'synapse/handlers/sync.py')
-rw-r--r-- | synapse/handlers/sync.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 7b356ba7e5..ff11266c67 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -252,13 +252,13 @@ class SyncHandler: self.storage = hs.get_storage() self.state_store = self.storage.state - # ExpiringCache((User, Device)) -> LruCache(state_key => event_id) + # ExpiringCache((User, Device)) -> LruCache(user_id => event_id) self.lazy_loaded_members_cache = ExpiringCache( "lazy_loaded_members_cache", self.clock, max_len=0, expiry_ms=LAZY_LOADED_MEMBERS_CACHE_MAX_AGE, - ) + ) # type: ExpiringCache[Tuple[str, Optional[str]], LruCache[str, str]] async def wait_for_sync_for_user( self, @@ -733,8 +733,10 @@ class SyncHandler: def get_lazy_loaded_members_cache( self, cache_key: Tuple[str, Optional[str]] - ) -> LruCache: - cache = self.lazy_loaded_members_cache.get(cache_key) + ) -> LruCache[str, str]: + cache = self.lazy_loaded_members_cache.get( + cache_key + ) # type: Optional[LruCache[str, str]] if cache is None: logger.debug("creating LruCache for %r", cache_key) cache = LruCache(LAZY_LOADED_MEMBERS_CACHE_MAX_SIZE) |