Skip to content

Commit 550caa6

Browse files
authored
fix: added conditional check for the unkey logger to reduce the number of logs (calcom#25858)
1 parent a8f43da commit 550caa6

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

packages/lib/rateLimit.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@ export type RateLimitHelper = {
2828

2929
export const API_KEY_RATE_LIMIT = 30;
3030

31+
let warned = false;
32+
3133
export function rateLimiter() {
3234
const { UNKEY_ROOT_KEY } = process.env;
3335

3436
if (!UNKEY_ROOT_KEY) {
35-
log.warn("Disabled because the UNKEY_ROOT_KEY environment variable was not found.");
37+
if (!warned) {
38+
log.warn("Disabled because the UNKEY_ROOT_KEY environment variable was not found.");
39+
warned = true;
40+
}
3641
return () => ({ success: true, limit: 10, remaining: 999, reset: 0 } as RatelimitResponse);
3742
}
3843
const timeout = {

0 commit comments

Comments
 (0)