Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(api): fallback to soonest-expiring eviction when all entries are rate-limited
Minit83a0eee2916b
diff --git a/apps/web/app/api/utils.ts b/apps/web/app/api/utils.tsindex 7d992dbb4..0eb33aa57 100644--- a/apps/web/app/api/utils.ts+++ b/apps/web/app/api/utils.ts@@ -38,6 +38,15 @@ export const developerRateLimiter = createMiddleware(async (c, next) => {if (requestCounts.size <= RATE_LIMIT_MAX_ENTRIES) break;if (v.count < RATE_LIMIT_MAX_REQUESTS) requestCounts.delete(k);}+ if (requestCounts.size > RATE_LIMIT_MAX_ENTRIES) {+ const byExpiry = [...requestCounts.entries()].sort(+ (a, b) => a[1].resetAt - b[1].resetAt,+ );+ for (const [k] of byExpiry) {+ if (requestCounts.size <= RATE_LIMIT_MAX_ENTRIES) break;+ requestCounts.delete(k);+ }+ }}}