From f7ba86b2626770e167b3488d426aefbcd9975eef Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 23 Jan 2024 15:59:17 +0200 Subject: [PATCH] contingency for redis-cli flushall --- files/routes/static.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/routes/static.py b/files/routes/static.py index a9dca7e67..bd5480653 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -137,7 +137,9 @@ def sidebar(v): @limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID) @auth_required def participation_stats(v): - stats = cache.get('stats') or {} + stats = cache.get('stats') + if not stats: + cache.set('stats', stats.stats(), timeout=172800) if v.client: return stats return render_template("stats.html", v=v, title="Statistics", data=stats)