Skip to content

Commit 3c95623

Browse files
fix(rate-limit): avoid load test on ServeRest
Reducing rate limit from 7500 req/min to 900
1 parent 2acbbdc commit 3c95623

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ app.use(express.urlencoded({ extended: false }))
2929
app.use(queryParser())
3030
app.use(timeout())
3131
app.use(cors())
32-
app.use(rateLimiter)
32+
33+
/* istanbul ignore next */
34+
if (!ehAmbienteDeTestes) {
35+
app.use(rateLimiter)
36+
}
3337

3438
app.disable('etag')
3539

src/middlewares/rate-limiter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const { RateLimiterMemory } = require('rate-limiter-flexible')
55
const { aplicacaoExecutandoLocalmente } = require('../utils/ambiente')
66

77
const rateLimiter = new RateLimiterMemory({
8-
points: 250, // requests
8+
points: 30, // requests
99
duration: 2 // segundo por IP
1010
})
1111

0 commit comments

Comments
 (0)