Skip to content
Snippets Groups Projects
Commit 1216b46b authored by Gabriel Engel's avatar Gabriel Engel Committed by GitHub
Browse files

Merge pull request #5954 from RocketChat/rate-limiter-remove-test

Remove Rate Limiters For Testing
parents e547a45e a7378e7a
No related branches found
No related tags found
No related merge requests found
RocketChat.RateLimiter = new class
limitFunction: (fn, numRequests, timeInterval, matchers) ->
if process.env.TEST_MODE is 'true'
return fn
rateLimiter = new RateLimiter()
rateLimiter.addRule matchers, numRequests, timeInterval
return ->
......@@ -16,6 +18,8 @@ RocketChat.RateLimiter = new class
throw new Meteor.Error 'error-too-many-requests', "Error, too many requests. Please slow down. You must wait #{Math.ceil(rateLimitResult.timeToReset / 1000)} seconds before trying again.", { timeToReset: rateLimitResult.timeToReset, seconds: Math.ceil(rateLimitResult.timeToReset / 1000) }
limitMethod: (methodName, numRequests, timeInterval, matchers) ->
if process.env.TEST_MODE is 'true'
return
match =
type: 'method'
name: methodName
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment