From df30b75c613a209a2d21e2b2ce1d960d2153ffa6 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:07:06 -0800 Subject: [PATCH] oops actually use the cache --- src/documents/views.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/documents/views.py b/src/documents/views.py index 4adf645e66..53ff032f07 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -4369,19 +4369,20 @@ def get_github_stars() -> int | None: Fetch the number of stars for the Paperless-NGX repository from GitHub. """ count = cache.get(GITHUB_CACHE_KEY % "stars") + if count is not None: + return count try: resp = httpx.get( "https://api.github.com/repos/paperless-ngx/paperless-ngx", - headers={"Accept": "application/vnd.github.v3+json"}, + headers={"Accept": "application/vnd.github+json"}, ) resp.raise_for_status() - data = resp.json() - count = data.get("stargazers_count") - cache.set(GITHUB_CACHE_KEY % "stars", count, 60 * 60) - return count + count = resp.json()["stargazers_count"] except Exception as e: logger.debug(f"An error occurred fetching GitHub stars: {e}") return None + cache.set(GITHUB_CACHE_KEY % "stars", count, 60 * 60) + return count @extend_schema_view(