Skip to content

Commit

Permalink
fix ratelimiting for past hunts
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Mar 21, 2020
1 parent 4fd2c61 commit 573c199
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions huntserver/hunt_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,11 @@ def puzzle_view(request, puzzle_id):
if(team is not None):
request.ratelimit_key = team.team_name

is_ratelimited(request, fn=puzzle_view, key='user', rate='2/10s', method='POST', increment=True)
is_ratelimited(request, fn=puzzle_view, key=get_ratelimit_key, rate='5/m',
method='POST', increment=True)
is_ratelimited(request, fn=puzzle_view, key='user', rate='2/10s', method='POST',
increment=True)
if(not puzzle.hunt.is_public):
is_ratelimited(request, fn=puzzle_view, key=get_ratelimit_key, rate='5/m', method='POST',
increment=True)

if(getattr(request, 'limited', False)):
logger.info("User %s rate-limited for puzzle %s" % (str(request.user), puzzle_id))
Expand Down

0 comments on commit 573c199

Please sign in to comment.