MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / getRateLimitStatus

Function getRateLimitStatus

src/utils/rateLimiter.js:33–47  ·  view source on GitHub ↗
(key, windowMs = 60000)

Source from the content-addressed store, hash-verified

31}
32
33export function getRateLimitStatus(key, windowMs = 60000) {
34 const entry = rateLimitStore.get(key);
35 if (!entry) {
36 return { limited: false, remaining: windowMs };
37 }
38
39 const elapsed = Date.now() - entry.windowStart;
40 const remaining = Math.max(0, windowMs - elapsed);
41
42 return {
43 limited: remaining > 0,
44 remaining,
45 attempts: entry.count
46 };
47}
48
49export function clearRateLimit(key) {
50 rateLimitStore.delete(key);

Callers 2

enforceAbuseProtectionFunction · 0.90
isUserRateLimitedFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected