import { RestManager } from "../bot.ts";
export function processRateLimitedPaths(rest: RestManager) { const now = Date.now();
for (const [key, value] of rest.ratelimitedPaths.entries()) { rest.debug(`[REST - processRateLimitedPaths] Running for of loop. ${value.resetTimestamp - now}`); if (value.resetTimestamp > now) continue;
rest.ratelimitedPaths.delete(key); if (key === "global") rest.globallyRateLimited = false; }
if (!rest.ratelimitedPaths.size) { rest.processingRateLimitedPaths = false; } else { rest.processingRateLimitedPaths = true; setTimeout(() => { rest.debug(`[REST - processRateLimitedPaths] Running setTimeout.`); rest.processRateLimitedPaths(rest); }, 1000); }}