Skip to content

Commit

Permalink
limiting generations to 1 per day
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutlope committed Mar 5, 2023
1 parent 1643cb4 commit 6e45975
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
8 changes: 5 additions & 3 deletions pages/api/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ interface ExtendedNextApiRequest extends NextApiRequest {
};
}

// Create a new ratelimiter, that allows 3 requests per 24 hours
// Create a new ratelimiter, that allows 1 request per 24 hours
const ratelimit = redis
? new Ratelimit({
redis: redis,
limiter: Ratelimit.fixedWindow(3, "1440 m"),
limiter: Ratelimit.fixedWindow(1, "1440 m"),
analytics: true,
})
: undefined;
Expand All @@ -40,7 +40,9 @@ export default async function handler(
if (!result.success) {
res
.status(429)
.json("Too many uploads in 1 day. Please try again in 24 hours.");
.json(
"We're temporarily limiting generations to 1 per day because of high traffic. Please try again in 24 hours. For any questions, email [email protected]"
);
return;
}
}
Expand Down
11 changes: 7 additions & 4 deletions pages/dream.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,13 @@ const Home: NextPage = () => {
<h1 className="mx-auto max-w-4xl font-display text-4xl font-bold tracking-normal text-slate-100 sm:text-6xl mb-5">
Generate your <span className="text-blue-600">dream</span> room
</h1>
<p className="text-slate-500">
{/* Obtained this number from Vercel: based on how many serverless invocations happened. */}
<CountUp start={50000} end={141531} duration={1} separator="," />{" "}
rooms generated so far.
<p className="text-gray-400">
<span className="font-bold text-gray-300">Note:</span> We're
temporarily{" "}
<span className="font-bold text-gray-300">
limiting generations to 1 per day
</span>{" "}
because of high traffic.
</p>
<ResizablePanel>
<AnimatePresence mode="wait">
Expand Down

1 comment on commit 6e45975

@vercel
Copy link

@vercel vercel bot commented on 6e45975 Mar 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.