Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, March 26th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
1310e2f1
Commit
1310e2f1
authored
6 years ago
by
christopher lee
Browse files
Options
Downloads
Patches
Plain Diff
Clean up enrollment rate limit waffles
LEARNER-5038
parent
e8604ac3
Branches
Branches containing commit
Tags
release-2020-11-06-13.30
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/djangoapps/enrollment/__init__.py
+0
-9
0 additions, 9 deletions
common/djangoapps/enrollment/__init__.py
common/djangoapps/enrollment/views.py
+1
-24
1 addition, 24 deletions
common/djangoapps/enrollment/views.py
with
1 addition
and
33 deletions
common/djangoapps/enrollment/__init__.py
+
0
−
9
View file @
1310e2f1
"""
Enrollment API helpers and settings
"""
from
openedx.core.djangoapps.waffle_utils
import
(
WaffleFlag
,
WaffleFlagNamespace
)
WAFFLE_FLAG_NAMESPACE
=
WaffleFlagNamespace
(
name
=
'
enrollment_api_rate_limit
'
)
REDUCE_RATE_LIMIT_FOR_STAFF_FOR_ENROLLMENT_API
=
WaffleFlag
(
WAFFLE_FLAG_NAMESPACE
,
'
reduce_staff_rate_limit
'
)
USE_UNIVERSAL_RATE_LIMIT_FOR_ENROLLMENT_API
=
WaffleFlag
(
WAFFLE_FLAG_NAMESPACE
,
'
use_universal_rate_limit
'
)
This diff is collapsed.
Click to expand it.
common/djangoapps/enrollment/views.py
+
1
−
24
View file @
1310e2f1
...
...
@@ -12,8 +12,6 @@ from django.utils.decorators import method_decorator
from
edx_rest_framework_extensions.authentication
import
JwtAuthentication
from
enrollment
import
api
from
enrollment.errors
import
CourseEnrollmentError
,
CourseEnrollmentExistsError
,
CourseModeNotFoundError
from
enrollment
import
REDUCE_RATE_LIMIT_FOR_STAFF_FOR_ENROLLMENT_API
,
\
USE_UNIVERSAL_RATE_LIMIT_FOR_ENROLLMENT_API
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
...
...
@@ -78,28 +76,7 @@ class ApiKeyPermissionMixIn(object):
class
EnrollmentUserThrottle
(
UserRateThrottle
,
ApiKeyPermissionMixIn
):
"""
Limit the number of requests users can make to the enrollment API.
"""
# TODO: After confirming that reducing the throttle is successful, remove
# and clean up waffles. The rate limit has been increased over the course
# of a few months to account for unnecessary calls from the ecommerce
# service. These calls are no longer made and the plan is to set the
# rate limit back to its original state. LEARNER-5148
# Current rate limit
THROTTLE_RATES
=
{
'
user
'
:
'
40/minute
'
,
'
staff
'
:
'
2000/minute
'
,
}
# Less aggressive reduction in throttle limit. This should not be necessary
if
REDUCE_RATE_LIMIT_FOR_STAFF_FOR_ENROLLMENT_API
.
is_enabled
():
THROTTLE_RATES
=
{
'
user
'
:
'
40/minute
'
,
'
staff
'
:
'
400/minute
'
,
}
# Original rate Limit before rate limit increases.
if
USE_UNIVERSAL_RATE_LIMIT_FOR_ENROLLMENT_API
.
is_enabled
():
rate
=
'
40/minute
'
rate
=
'
40/minute
'
def
allow_request
(
self
,
request
,
view
):
# Use a special scope for staff to allow for a separate throttle rate
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment