From 1eeba666f5130b032a6d39c78ba46c25f7f23084 Mon Sep 17 00:00:00 2001 From: Will Miao Date: Mon, 20 Apr 2026 18:27:38 +0800 Subject: [PATCH] fix(network): restore destination-scoped memory download guard --- py/services/downloader.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/py/services/downloader.py b/py/services/downloader.py index cfac9bf9..120148e2 100644 --- a/py/services/downloader.py +++ b/py/services/downloader.py @@ -804,7 +804,8 @@ class Downloader: Tuple[bool, Union[bytes, str], Optional[Dict]]: (success, content or error message, response headers if requested) """ guard = await ConnectivityGuard.get_instance() - if guard.should_block_request(): + destination = self._guard_destination(url) + if guard.should_block_request(destination): return False, OFFLINE_FRIENDLY_MESSAGE, None try: @@ -849,8 +850,8 @@ class Downloader: except Exception as e: if guard.is_network_unreachable_error(e): - guard.register_network_failure(e) - if guard.should_block_request(): + guard.register_network_failure(e, destination) + if guard.should_block_request(destination): return False, OFFLINE_FRIENDLY_MESSAGE, None logger.debug("Network unavailable during memory download: %s", e) return False, str(e), None