You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[decorators] @cache never evicts; @rate_limit is process-global and raises bare ValueError #42
In nitrostack/core/additional_decorators.py, @cache never evicts entries and has no size cap, and @rate_limit raises a bare ValueError and shares one counter across all callers.
Findings
cache(): cache_store is a per-function dict. An expired entry is only overwritten when the same key is requested again, so high-cardinality arguments grow the dict without bound.
rate_limit(): one calls list per decorated function, so the limit applies to all users and instances together. It raises ValueError("Rate limit exceeded ..."), which a client cannot tell apart from a validation error, and it gives no retry hint.
Both are in-process only.
Proposal
cache(ttl, max_size=...) with LRU eviction, plus a cache_clear() hook for tests.
A typed RateLimitExceededError carrying retry_after_seconds.
An optional key= callable on rate_limit for per-user limits.
Activity
Merge pull request #47 from Shreyavemana/feat/cache-eviction-rate-limit
manish-wekan commentedon Nov 2, 2026
Fixed by #47 (merged into
developas 599315c).