From 4a6a948ac284c7b96cdf8839de225124b1533d78 Mon Sep 17 00:00:00 2001 From: mountain Date: Tue, 7 Jul 2026 16:02:33 +0800 Subject: [PATCH] style(cloud): annotate best-effort response-close in query_stream cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the bare `except Exception: pass` around resp.close() in the query_stream finally block with an explanatory comment and a debug log (flagged by github-code-quality on PR #272). Behavior unchanged — the close is best-effort to unblock the background thread. Claude-Session: https://claude.ai/code/session_01Kx5DgKbhK1N8autqXH8SmS --- pageindex/backend/cloud.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pageindex/backend/cloud.py b/pageindex/backend/cloud.py index 0c2a0d2..4f74fce 100644 --- a/pageindex/backend/cloud.py +++ b/pageindex/backend/cloud.py @@ -465,7 +465,10 @@ class CloudBackend: try: resp.close() except Exception: - pass + # Best-effort: the response may already be closed/invalid + # during teardown; closing is just to unblock the thread. + logger.debug("Ignoring error closing streaming response during cleanup", + exc_info=True) thread.join(timeout=5) def _get_all_doc_ids(self, collection: str) -> list[str]: