style: clean up code formatting and remove trailing whitespace

refactor: reorganize imports and fix type imports
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-11 03:08:36 -03:00
1 parent d3704602fd
commit 47c04de6fe
232 files changed
+7140 -4798

No files matched your search

+17 -14
View File
@@ -54,21 +54,24 @@ const RATE_LIMITS: Record<string, RateLimitConfig> = {
};
// Limpar cache expirado a cada 5 minutos
setInterval(() => {
const now = Date.now();
let cleaned = 0;
setInterval(
() => {
const now = Date.now();
let cleaned = 0;
for (const [key, entry] of requestCache.entries()) {
if (now > entry.resetAt) {
requestCache.delete(key);
cleaned++;
for (const [key, entry] of requestCache.entries()) {
if (now > entry.resetAt) {
requestCache.delete(key);
cleaned++;
}
}
}
if (cleaned > 0) {
console.log(`🧹 Rate limiter: ${cleaned} entradas expiradas removidas`);
}
}, 5 * 60 * 1000);
if (cleaned > 0) {
console.log(`🧹 Rate limiter: ${cleaned} entradas expiradas removidas`);
}
},
5 * 60 * 1000,
);
/**
* Verifica se uma requisição excede o rate limit
@@ -78,7 +81,7 @@ setInterval(() => {
*/
export function checkRateLimit(
ip: string,
path: string
path: string,
): {
allowed: boolean;
remaining: number;
@@ -180,6 +183,6 @@ export function createRateLimitResponse(resetAt: number): Response {
"X-RateLimit-Remaining": "0",
"X-RateLimit-Reset": new Date(resetAt).toISOString(),
},
}
},
);
}