Skip to content

Commit c711c18

Browse files
committed
remove 2x limit window leeway
1 parent 91f07d8 commit c711c18

File tree

1 file changed

+8
-11
lines changed
  • packages/service-utils/src/core/rateLimit

1 file changed

+8
-11
lines changed

packages/service-utils/src/core/rateLimit/index.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,14 @@ export async function rateLimit(args: {
8282
});
8383
}
8484

85-
// Reject requests when they've exceeded 2x the rate limit.
86-
if (requestCount > 2 * limitPerWindow) {
87-
return {
88-
rateLimited: true,
89-
requestCount,
90-
rateLimit: limitPerWindow,
91-
status: 429,
92-
errorMessage: `You've exceeded your ${serviceScope} rate limit at ${limitPerSecond} reqs/sec. To get higher rate limits, contact us at https://thirdweb.com/contact-us.`,
93-
errorCode: "RATE_LIMIT_EXCEEDED",
94-
};
95-
}
85+
return {
86+
rateLimited: true,
87+
requestCount,
88+
rateLimit: limitPerWindow,
89+
status: 429,
90+
errorMessage: `You've exceeded your ${serviceScope} rate limit at ${limitPerSecond} reqs/sec. To get higher rate limits, contact us at https://thirdweb.com/contact-us.`,
91+
errorCode: "RATE_LIMIT_EXCEEDED",
92+
};
9693
}
9794

9895
return {

0 commit comments

Comments
 (0)