This commit is contained in:
Yurii Parfinenko 2026-01-27 11:08:47 -05:00
parent 785130bbd6
commit 185a8dee43
No known key found for this signature in database
GPG key ID: DC2DA451C163B361
2 changed files with 2 additions and 5 deletions

View file

@ -71,9 +71,6 @@ def get_approx_account_lockouts_from_login_attempts(ip_address=None, username=No
lockouts = AccessAttempt.objects.filter(q).count() // failure_limit
# Cache for the same window length used by the DB query.
cache_ttl = int(config.ACCESS_ATTEMPT_EXPIRATION * 60 * 60)
redis_client.set(cache_key, int(lockouts), cache_ttl)
redis_client.set(cache_key, int(lockouts), 60)
return lockouts

View file

@ -976,7 +976,7 @@ class AccessAttemptTest(DefenderTestCase):
ip_address="127.0.0.1", username=VALID_USERNAME
)
)
self.assertIsNone(cached_value)
self.assertIsNotNone(cached_value)
class SignalTest(DefenderTestCase):