liujintao 1 bulan lalu
induk
melakukan
56efe74203
1 mengubah file dengan 2 tambahan dan 5 penghapusan
  1. 2 5
      app/services/cache.py

+ 2 - 5
app/services/cache.py

@@ -62,13 +62,12 @@ async def get_snapshot() -> dict[str, Any]:
         if not raw:
             return dict(_EMPTY_SNAPSHOT)
         return json.loads(raw)
-    except Exception as exc:  # noqa: BLE001
-        # Redis 故障不应影响搜索请求,降级为空过滤
+    except Exception as exc:
         logger.warning("读取 Redis 缓存失败,使用空快照: %s", exc)
         return dict(_EMPTY_SNAPSHOT)
 
 
-async def refresh_cache(force: bool = False) -> bool:
+async def refresh_cache(force: bool = False) -> bool | None:
     """从 Zendesk 拉取最新数据并写入 Redis。
 
     使用 KEY_LOCK_REFRESH 防并发刷新(避免重复打 Zendesk)。
@@ -126,8 +125,6 @@ async def refresh_cache(force: bool = False) -> bool:
 
 
 
-
-# ===== Leader 选举与心跳 =====
 async def try_become_leader() -> bool:
     """尝试成为 leader(仅一个 worker 会成功)。"""
     try: