MCPcopy
hub / github.com/AstrBotDevs/AstrBot / get_or_create

Method get_or_create

astrbot/dashboard/server.py:83–91  ·  view source on GitHub ↗
(
        self, key: str, capacity: int, refill_rate: float
    )

Source from the content-addressed store, hash-verified

81 self._last_eviction = time.monotonic()
82
83 def get_or_create(
84 self, key: str, capacity: int, refill_rate: float
85 ) -> _AuthRateLimiter:
86 self._evict_expired()
87 limiter = self._limiters.get(key)
88 if limiter is None:
89 limiter = _AuthRateLimiter(capacity=capacity, refill_rate=refill_rate)
90 self._limiters[key] = limiter
91 return limiter
92
93 def _evict_expired(self) -> None:
94 now = time.monotonic()

Callers 1

Calls 3

_evict_expiredMethod · 0.95
_AuthRateLimiterClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected