From a0c5e591c6462de650c8a3799c0aaf49eb9e2240 Mon Sep 17 00:00:00 2001 From: KamilPawel Date: Mon, 18 Sep 2023 21:31:52 +0100 Subject: [PATCH] fix tests failing --- portal/helpers/ratelimit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/portal/helpers/ratelimit.py b/portal/helpers/ratelimit.py index ce373ab65..4ed226d52 100644 --- a/portal/helpers/ratelimit.py +++ b/portal/helpers/ratelimit.py @@ -161,7 +161,7 @@ def get_usage(request, group=None, fn=None, key=None, rate=None, method=ALL, inc cache_name = getattr(settings, "RATELIMIT_USE_CACHE", "default") cache = caches[cache_name] - cache_key = _make_cache_key(group, window, rate, request.session.get("auth-username", ""), method) + cache_key = _make_cache_key(group, window, rate, value or request.session.get("auth-username", ""), method) count = None added = cache.add(cache_key, initial_value, period + EXPIRATION_FUDGE)