From 1dfe98925a8da04a68cca023c2e65f00993f2db9 Mon Sep 17 00:00:00 2001 From: Petitminion Date: Wed, 24 May 2023 16:47:50 +0200 Subject: [PATCH] avoid setting useless cache --- api/funkwhale_api/radios/radios.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/funkwhale_api/radios/radios.py b/api/funkwhale_api/radios/radios.py index ca22f99b1..ead3a99ab 100644 --- a/api/funkwhale_api/radios/radios.py +++ b/api/funkwhale_api/radios/radios.py @@ -87,7 +87,7 @@ class SessionRadio(SimpleRadio): queryset = cache.get( f"radioqueryset{self.__class__.__name__}{self.session.session_key}" ) - else: + elif self.session: queryset = self.get_queryset(**kwargs) logger.info("Setting redis cache for radio generation") cache.set( @@ -95,6 +95,9 @@ class SessionRadio(SimpleRadio): queryset, 3600, ) + else: + queryset = self.get_queryset(**kwargs) + if self.session: queryset = self.filter_from_session(queryset) if kwargs.pop("filter_playable", True):