Skip to content

Commit

Permalink
modify serve.ts 5
Browse files Browse the repository at this point in the history
  • Loading branch information
hideckies committed Dec 23, 2023
1 parent 40410f6 commit 3570f0b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ server.use(async (request, next, conn) => {
// Rate limiting
if (rateLimitter.requestCount < maxRequests) {
rateLimitter.requestCount += 1;
console.log(`Request from ${JSON.stringify(remoteAddr)}. requestCount: ${JSON.stringify(rateLimitter.requestCount)}.`);
} else {
console.log(`Rate limiting for ${JSON.stringify(remoteAddr)}. Sleep 30 seconds.`);
await sleep(30);
}

await sleep(1);
await sleep(2);

return response;
})
Expand Down

0 comments on commit 3570f0b

Please sign in to comment.