Skip to content

Commit

Permalink
Update configuration options RateLimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
pH-7 committed May 6, 2024
1 parent b035d34 commit 47d3d6c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,12 @@ function statusEndpointServerHook<T extends ViteDevServer | PreviewServer>(
function searchEndpointServerHook<T extends ViteDevServer | PreviewServer>(
server: T,
) {
const rateLimiter = new RateLimiterMemory({
points: 2,
duration: 10,
});
// give an ideal options for the rate limiter
const rateLimiterOptions = {
points: 4, // allocate points
duration: 5, // per second
};
const rateLimiter = new RateLimiterMemory(rateLimiterOptions);

server.middlewares.use(async (request, response, next) => {
if (!request.url.startsWith("/search")) {
Expand Down

0 comments on commit 47d3d6c

Please sign in to comment.