Permalink
Browse files

Add an option to disable rate limiting. For testing.

  • Loading branch information...
1 parent e853b92 commit 1ecb427fdd700287dd926205de515b6e1f4c211e @andre-d andre-d committed with chromakode Aug 10, 2011
Showing with 6 additions and 0 deletions.
  1. +1 −0 r2/example.ini
  2. +4 −0 r2/r2/controllers/validator/validator.py
  3. +1 −0 r2/r2/lib/app_globals.py
View
@@ -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
@@ -1091,6 +1091,8 @@ def __init__(self, rate_user = False, rate_ip = False,
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 @@ def __init__(self, category, *a, **kw):
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:
@@ -85,6 +85,7 @@ class Globals(object):
'db_create_tables',
'disallow_db_writes',
'exception_logging',
+ 'disable_ratelimit',
'amqp_logging',
'read_only_mode',
'frontpage_dart',

0 comments on commit 1ecb427

Please sign in to comment.