You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// if the request is rate limited, return the rate limit result.
37
+
if(rateLimitResult.rateLimited){
56
38
return{
57
39
rateLimited: true,
58
-
requestCount: totalCount,
59
-
rateLimit: limitPerWindow,
40
+
requestCount: rateLimitResult.requestCount,
41
+
rateLimit: rateLimitResult.rateLimit,
60
42
status: 429,
61
-
errorMessage: `You've exceeded your ${serviceScope} rate limit at ${limitPerSecond}reqs/sec. Please upgrade your plan to get higher rate limits.`,
43
+
errorMessage: `You've exceeded your ${serviceScope} rate limit at ${limitPerSecond}requests per second. Please upgrade your plan to increase your limits: https://thirdweb.com/team/${team.slug}/~/settings/billing`,
62
44
errorCode: "RATE_LIMIT_EXCEEDED",
63
45
};
64
46
}
65
-
66
-
// Non-blocking: increment the request count for the current second.
67
-
(async()=>{
68
-
try{
69
-
constkey=getRequestCountAtSecondCacheKey(
70
-
serviceScope,
71
-
team.id,
72
-
currentSecond,
73
-
);
74
-
awaitredis.incrby(key,increment);
75
-
// If this is the first time setting this key, expire it after the sliding window is past.
0 commit comments