Files

23 lines
695 B
Python
Raw Permalink Normal View History

"""n_plus_one, cold_cache, unbounded_cache -- phase-0-base-project-spec.md §7.
All three are owned by `insights`."""
from common.chaos_flags import is_enabled
async def n_plus_one_enabled() -> bool:
return await is_enabled("n_plus_one")
async def cold_cache_enabled() -> bool:
return await is_enabled("cold_cache")
async def unbounded_cache_enabled() -> bool:
return await is_enabled("unbounded_cache")
# unbounded_cache: memoize summaries in a module-level dict keyed by
# (account_id, timestamp_ms) -- effectively never hits, never evicts, grows
# forever. This is the pathology itself, not a fix for anything -- never
# clear it, never cap it.
UNBOUNDED_CACHE: dict = {}