Skip to content

Commit 6ca8783

Browse files
Richard Taylorclaude
authored andcommitted
Add connection timeout to DownloadManager session.get()
The HTTP connection (session.get) had no timeout, only individual chunk reads did. If the TCP connection or TLS handshake stalled, the entire async balance fetch loop would hang forever. This was observed on ESP32 devices where intermittent WiFi issues caused session.get() to never return, freezing the wallet UI on "Connecting to backend". Uses the existing _CHUNK_TIMEOUT_SECONDS (10s) for the connection timeout. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent c30db3e commit 6ca8783

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

internal_filesystem/lib/mpos/net/download_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ async def _download_url_async(cls, url, outfile=None, total_size=None,
115115
if headers is None:
116116
headers = {}
117117

118-
async with session.get(url, headers=headers) as response:
118+
async with session.get(url, headers=headers, timeout=_CHUNK_TIMEOUT_SECONDS) as response:
119119
if response.status < 200 or response.status >= 400:
120120
print(f"DownloadManager: HTTP error {response.status}")
121121
raise RuntimeError(f"HTTP {response.status}")

0 commit comments

Comments
 (0)