hotfix: unreachable rate limits

This commit is contained in:
zomars 2023-10-23 13:15:43 -07:00
parent 1de60bcfeb
commit 154af1367a

View File

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