Skip to content

Commit

Permalink
Make submission_request_method_to_throttle configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankApiyo committed Aug 27, 2024
1 parent 3cce05a commit 25e9d5c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion onadata/libs/throttle.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ def get_form_owner_or_project_from_url(self, url):
return None

def get_cache_key(self, request, _):
if (request.method == 'POST' and '/submission' in request.path
request_methods_to_throttle = getattr(
settings,
"SUBMISSION_REQUEST_METHODS_TO_THROTTLE",
['POST']
)
if (request.method in request_methods_to_throttle
and '/submission' in request.path
and self.get_form_owner_or_project_from_url(request.path)):
return f"throttle_method_{request.method}_path_{request.path}"
return None
Expand Down

0 comments on commit 25e9d5c

Please sign in to comment.