Skip to content

Scheduling infrastructure for absolutely everyone.

fix: added conditional check for the unkey logger to reduce the number of logs (#25858)

an_ifrah24550caa666580
diff --git a/packages/lib/rateLimit.ts b/packages/lib/rateLimit.ts
index 5a0723774fe..ebdc90460a5 100644
--- a/packages/lib/rateLimit.ts
+++ b/packages/lib/rateLimit.ts
@@ -28,11 +28,16 @@ export type RateLimitHelper = {
export const API_KEY_RATE_LIMIT = 30;
+let warned = false;
+
export function rateLimiter() {
const { UNKEY_ROOT_KEY } = process.env;
if (!UNKEY_ROOT_KEY) {
- log.warn("Disabled because the UNKEY_ROOT_KEY environment variable was not found.");
+ if (!warned) {
+ log.warn("Disabled because the UNKEY_ROOT_KEY environment variable was not found.");
+ warned = true;
+ }
return () => ({ success: true, limit: 10, remaining: 999, reset: 0 } as RatelimitResponse);
}
const timeout = {