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

documentation incorrectly states that event_cache_size is unaffected by caches.global_factor #13682

Closed
richvdh opened this issue Aug 31, 2022 · 3 comments · Fixed by #13726
Closed
Labels
A-Config Configuration, or the documentation thereof A-Docs things relating to the documentation O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@richvdh
Copy link
Member

richvdh commented Aug 31, 2022

Afaict, this changed in #8563

@richvdh
Copy link
Member Author

richvdh commented Aug 31, 2022

@richvdh
Copy link
Member Author

richvdh commented Aug 31, 2022

related: #13681

@squahtx squahtx added A-Config Configuration, or the documentation thereof S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. O-Uncommon Most users are unlikely to come across this or unexpected workflow labels Sep 1, 2022
@DMRobertson DMRobertson added the A-Docs things relating to the documentation label Sep 6, 2022
@DMRobertson
Copy link
Contributor

Details: the event_cache_size is used here to create an AsyncLRUCache

self._get_event_cache: AsyncLruCache[
Tuple[str], EventCacheEntry
] = AsyncLruCache(
cache_name="*getEvent*",
max_size=hs.config.caches.event_cache_size,
)

Which passes through to LRUCache:

class AsyncLruCache(Generic[KT, VT]):
"""
An asynchronous wrapper around a subset of the LruCache API.
On its own this doesn't change the behaviour but allows subclasses that
utilize external cache systems that require await behaviour to be created.
"""
def __init__(self, *args, **kwargs): # type: ignore
self._lru_cache: LruCache[KT, VT] = LruCache(*args, **kwargs)

which will scale the max_size by the global factor:

if apply_cache_factor_from_config:
self.max_size = int(max_size * cache_config.properties.default_factor_size)
else:
self.max_size = int(max_size)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Config Configuration, or the documentation thereof A-Docs things relating to the documentation O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants