Skip to content

Commit

Permalink
Utils: Log rate-limiting lockouts
Browse files Browse the repository at this point in the history
This allows to analyze such issues easier.
  • Loading branch information
nijel committed Apr 23, 2021
1 parent f7070ab commit 7d4938d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions weblate/utils/ratelimit.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from django.shortcuts import redirect
from django.template.loader import render_to_string

from weblate.logger import LOGGER
from weblate.utils import messages
from weblate.utils.hash import calculate_checksum
from weblate.utils.request import get_ip_address
Expand Down Expand Up @@ -89,6 +90,7 @@ def check_rate_limit(scope, request):
if attempts > get_rate_setting(scope, "ATTEMPTS"):
# Set key to longer expiry for lockout period
cache.set(key, attempts, get_rate_setting(scope, "LOCKOUT"))
LOGGER.info("rate-limit lockout for %s in %s scope", key, scope)
return False

return True
Expand Down

0 comments on commit 7d4938d

Please sign in to comment.