hotfix: unreachable rate limits

pull/11694/head^2
zomars 2023-10-23 13:15:43 -07:00
parent 1de60bcfeb
commit 154af1367a
1 changed files with 1 additions and 1 deletions

View File

@ -9,7 +9,7 @@ export async function checkRateLimitAndThrowError({
}: RateLimitHelper) { }: RateLimitHelper) {
const { remaining, reset } = await rateLimiter()({ rateLimitingType, identifier }); const { remaining, reset } = await rateLimiter()({ rateLimitingType, identifier });
if (remaining < 0) { if (remaining < 1) {
const convertToSeconds = (ms: number) => Math.floor(ms / 1000); const convertToSeconds = (ms: number) => Math.floor(ms / 1000);
const secondsToWait = convertToSeconds(reset - Date.now()); const secondsToWait = convertToSeconds(reset - Date.now());
throw new TRPCError({ throw new TRPCError({