diff --git a/r2/example.ini b/r2/example.ini index a81257015..42a021741 100755 --- a/r2/example.ini +++ b/r2/example.ini @@ -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 diff --git a/r2/r2/controllers/validator/validator.py b/r2/r2/controllers/validator/validator.py index da2fb566b..07b94054e 100644 --- a/r2/r2/controllers/validator/validator.py +++ b/r2/r2/controllers/validator/validator.py @@ -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: diff --git a/r2/r2/lib/app_globals.py b/r2/r2/lib/app_globals.py index 7036a9dc2..73b1b0402 100755 --- a/r2/r2/lib/app_globals.py +++ b/r2/r2/lib/app_globals.py @@ -85,6 +85,7 @@ class Globals(object): 'db_create_tables', 'disallow_db_writes', 'exception_logging', + 'disable_ratelimit', 'amqp_logging', 'read_only_mode', 'frontpage_dart',