mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-26 23:39:11 -05:00
Add an option to disable rate limiting. For testing.
This commit is contained in:
@@ -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 @@ 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:
|
||||
|
||||
@@ -85,6 +85,7 @@ class Globals(object):
|
||||
'db_create_tables',
|
||||
'disallow_db_writes',
|
||||
'exception_logging',
|
||||
'disable_ratelimit',
|
||||
'amqp_logging',
|
||||
'read_only_mode',
|
||||
'frontpage_dart',
|
||||
|
||||
Reference in New Issue
Block a user