mirror of
https://github.com/lukevella/rallly.git
synced 2025-08-03 08:28:35 +02:00
🎨 Move short circuit
This commit is contained in:
parent
19f6196201
commit
4cdc409b8d
1 changed files with 4 additions and 4 deletions
|
@ -76,15 +76,15 @@ export const privateProcedure = t.procedure.use(
|
|||
);
|
||||
|
||||
export const rateLimitMiddleware = middleware(async ({ ctx, next }) => {
|
||||
if (!process.env.KV_REST_API_URL) {
|
||||
return next();
|
||||
}
|
||||
|
||||
const ratelimit = new Ratelimit({
|
||||
redis: kv,
|
||||
limiter: Ratelimit.slidingWindow(5, "1 m"),
|
||||
});
|
||||
|
||||
if (!process.env.KV_REST_API_URL) {
|
||||
return next();
|
||||
}
|
||||
|
||||
const clientIp = requestIp.getClientIp(ctx.req);
|
||||
|
||||
if (!clientIp) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue