Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release-freeze' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
naeem91 committed Apr 3, 2019
2 parents d195f09 + 84986ad commit 906a794
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1438,3 +1438,6 @@

############## Settings for CourseGraph ############################
COURSEGRAPH_JOB_QUEUE = LOW_PRIORITY_QUEUE

# Max no. of bad requests after which ratelimitier backend will block IP's access
RATE_LIMIT_BACKEND_MAX_REQUESTS = 30
4 changes: 4 additions & 0 deletions common/djangoapps/util/bad_request_rate_limiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
A utility class which wraps the RateLimitMixin 3rd party class to do bad request counting
which can be used for rate limiting
"""
from django.conf import settings

from ratelimitbackend.backends import RateLimitMixin


class BadRequestRateLimiter(RateLimitMixin):
"""
Use the 3rd party RateLimitMixin to help do rate limiting on the Password Reset flows
"""
# get max number value from settings instead of using default one
requests = settings.RATE_LIMIT_BACKEND_MAX_REQUESTS

def is_rate_limit_exceeded(self, request):
"""
Expand Down
6 changes: 6 additions & 0 deletions lms/envs/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -1188,3 +1188,9 @@
'COMPLETION_VIDEO_COMPLETE_PERCENTAGE',
COMPLETION_VIDEO_COMPLETE_PERCENTAGE,
)

# Max no. of bad requests after which ratelimitier backend will block IP's access
RATE_LIMIT_BACKEND_MAX_REQUESTS = ENV_TOKENS.get(
'RATE_LIMIT_BACKEND_MAX_REQUESTS',
RATE_LIMIT_BACKEND_MAX_REQUESTS
)
3 changes: 3 additions & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3401,3 +3401,6 @@
############### Settings for user-state-client ##################
# Maximum number of rows to fetch in XBlockUserStateClient calls. Adjust for performance
USER_STATE_BATCH_SIZE = 5000

# Max no. of bad requests after which ratelimitier backend will block IP's access
RATE_LIMIT_BACKEND_MAX_REQUESTS = 30

0 comments on commit 906a794

Please sign in to comment.