Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ewansheldon committed Jan 6, 2025
1 parent 3374ab3 commit 4239da3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ const server = http.createServer(async (req, res) => {
const ip = req.headers['x-forwarded-for'] ||
req.socket.remoteAddress;
if (ip && await limited(ip)) {
res.writeHead(429);
console.log('limited')
res.writeHead(429, headers);
} else {
console.log('not limited')
res.writeHead(200, headers);
if (req.url === '/asset_prices') {
res.end(JSON.stringify(await getPrices()));
Expand Down
2 changes: 1 addition & 1 deletion src/rate.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const limited = async ip => {
console.log(ip)
const key = `rateLimit:${ip}`
console.log(2)
const reqLimit = 100;
const reqLimit = 10;
console.log(3)
await redis.connect();
console.log(4)
Expand Down

0 comments on commit 4239da3

Please sign in to comment.