Add an option to disable rate limiting. For testing.

This commit is contained in:
Andre D
2011-08-10 16:19:41 -04:00
committed by Max Goodman
parent e853b9285f
commit 1ecb427fdd
3 changed files with 6 additions and 0 deletions

View File

@@ -46,6 +46,7 @@ INDEXTANK_API_URL =
# -- feature toggles --
disable_ads = false
disable_captcha = false
disable_ratelimit = false
# -- important settings --
# the domain that this app serves itself up as

View File

@@ -1091,6 +1091,8 @@ class VRatelimit(Validator):
Validator.__init__(self, *a, **kw)
def run (self):
if g.disable_ratelimit:
return
to_check = []
if self.rate_user and c.user_is_loggedin:
to_check.append('user' + str(c.user._id36))
@@ -1131,6 +1133,8 @@ class VDelay(Validator):
Validator.__init__(self, *a, **kw)
def run (self):
if g.disable_ratelimit:
return
key = "VDelay-%s-%s" % (self.category, request.ip)
prev_violations = g.cache.get(key)
if prev_violations:

View File

@@ -85,6 +85,7 @@ class Globals(object):
'db_create_tables',
'disallow_db_writes',
'exception_logging',
'disable_ratelimit',
'amqp_logging',
'read_only_mode',
'frontpage_dart',