hotfix: unreachable rate limits
parent
1de60bcfeb
commit
154af1367a
|
@ -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({
|
||||||
|
|
Loading…
Reference in New Issue