fix: use forEach instead of for-of to iterate Map entries

This commit is contained in:
Knee Cola
2025-12-08 01:36:41 +01:00
parent f4793fa6d3
commit 7212425961

View File

@@ -60,11 +60,11 @@ export function checkUploadRateLimit(ipAddress: string): { allowed: boolean; rem
*/ */
export function cleanupRateLimitStore() { export function cleanupRateLimitStore() {
const now = Date.now(); const now = Date.now();
for (const [key, entry] of rateLimitStore.entries()) { rateLimitStore.forEach((entry, key) => {
if (now > entry.resetAt) { if (now > entry.resetAt) {
rateLimitStore.delete(key); rateLimitStore.delete(key);
} }
} });
} }
// Auto-cleanup every 10 minutes // Auto-cleanup every 10 minutes