Skip to content

Commit 17a2cba

Browse files
committed
fix typecheck errors
1 parent a98a803 commit 17a2cba

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

apps/webapp/app/services/apiRateLimit.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const apiRateLimiter = authorizationRateLimitMiddleware({
2222
limiterCache: {
2323
fresh: 60_000 * 10, // Data is fresh for 10 minutes
2424
stale: 60_000 * 20, // Date is stale after 20 minutes
25+
maxItems: 1000,
2526
},
2627
limiterConfigOverride: async (authorizationValue) => {
2728
const authenticatedEnv = await authenticateAuthorizationHeader(authorizationValue, {

apps/webapp/app/services/authorizationRateLimitMiddleware.server.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ import { createCache, DefaultStatefulContext, Namespace, Cache as UnkeyCache } f
22
import { MemoryStore } from "@unkey/cache/stores";
33
import { Ratelimit } from "@upstash/ratelimit";
44
import { Request as ExpressRequest, Response as ExpressResponse, NextFunction } from "express";
5-
import { RedisOptions } from "ioredis";
65
import { createHash } from "node:crypto";
76
import { z } from "zod";
87
import { env } from "~/env.server";
8+
import { RedisWithClusterOptions } from "~/redis.server";
99
import { logger } from "./logger.server";
1010
import { createRedisRateLimitClient, Duration, RateLimiter } from "./rateLimiter.server";
1111
import { RedisCacheStore } from "./unkey/redisCacheStore.server";
12-
import { RedisWithClusterOptions } from "~/redis.server";
1312

1413
const DurationSchema = z.custom<Duration>((value) => {
1514
if (typeof value !== "string") {

apps/webapp/app/services/engineRateLimit.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { env } from "~/env.server";
2-
import { authenticateAuthorizationHeader } from "./apiAuth.server";
32
import { authorizationRateLimitMiddleware } from "./authorizationRateLimitMiddleware.server";
43
import { Duration } from "./rateLimiter.server";
54

@@ -22,6 +21,7 @@ export const engineRateLimiter = authorizationRateLimitMiddleware({
2221
limiterCache: {
2322
fresh: 60_000 * 10, // Data is fresh for 10 minutes
2423
stale: 60_000 * 20, // Date is stale after 20 minutes
24+
maxItems: 1000,
2525
},
2626
pathMatchers: [/^\/engine/],
2727
// Regex allow any path starting with /engine/v1/worker-actions/

apps/webapp/test/authorizationRateLimitMiddleware.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ describe.skipIf(process.env.GITHUB_ACTIONS)("authorizationRateLimitMiddleware",
368368
limiterCache: {
369369
fresh: 1000, // 1 second
370370
stale: 2000, // 2 seconds
371+
maxItems: 1000,
371372
},
372373
limiterConfigOverride: async (authorizationValue) => {
373374
configOverrideCalls++;

0 commit comments

Comments
 (0)