MCPcopy Create free account
hub / github.com/AmazingAng/PolyWorld / cleanup

Function cleanup

src/middleware.ts:52–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50const CLEANUP_INTERVAL = 5 * 60_000;
51
52function cleanup() {
53 const now = Date.now();
54 if (now - lastCleanup < CLEANUP_INTERVAL) return;
55 lastCleanup = now;
56 for (const map of Object.values(rateMaps)) {
57 for (const [key, bucket] of map) {
58 if (now >= bucket.resetAt) map.delete(key);
59 }
60 }
61}
62
63function getTier(pathname: string): keyof typeof rateMaps {
64 if (pathname === "/api/summarize") return "ai";

Callers 1

checkRateLimitFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected