From 556c9ea98fc8d7fd8e3c1afeab68cc3ee164a846 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 9 Jan 2022 12:16:01 -0800 Subject: [PATCH] Adjusts cache get_or_set to work with tests --- bookwyrm/utils/cache.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bookwyrm/utils/cache.py b/bookwyrm/utils/cache.py index 2fca1264..aebb8e75 100644 --- a/bookwyrm/utils/cache.py +++ b/bookwyrm/utils/cache.py @@ -6,5 +6,6 @@ def get_or_set(cache_key, function, *args, timeout=None): """Django's built-in get_or_set isn't cutting it""" value = cache.get(cache_key) if value is None: - cache.set(cache_key, function(*args), timeout=timeout) - return cache.get(cache_key) + value = function(*args) + cache.set(cache_key, value, timeout=timeout) + return value