fix: cache check for expire (#3087)
authorrelic664 <138946165+relic664@users.noreply.github.com>
Thu, 5 Feb 2026 10:24:18 +0000 (05:24 -0500)
committerGitHub <noreply@github.com>
Thu, 5 Feb 2026 10:24:18 +0000 (11:24 +0100)
* fix: cache check for expire

* fixed formatting

music_assistant/controllers/cache.py

index cc81b60598f894bf9616794724b86ee12301ba9b..da8e174ba1c944babcf9f6f424c96656d921703d 100644 (file)
@@ -119,10 +119,14 @@ class CacheController(CoreController):
             return cache_data[0]
         # fall back to db cache
         if (
-            db_row := await self.database.get_row(
-                DB_TABLE_CACHE, {"category": category, "provider": provider, "key": key}
+            (
+                db_row := await self.database.get_row(
+                    DB_TABLE_CACHE, {"category": category, "provider": provider, "key": key}
+                )
             )
-        ) and (not checksum or (db_row["checksum"] == checksum and db_row["expires"] >= cur_time)):
+            and db_row["expires"] >= cur_time
+            and (not checksum or db_row["checksum"] == checksum)
+        ):
             try:
                 data = await async_json_loads(db_row["data"])
             except Exception as exc: