Skip to content

Commit 683e272

Browse files
EstrellaXDclaude
andcommitted
fix(core): add max retry for downloader connection check
Prevents startup from hanging indefinitely when downloader is unreachable (e.g., due to proxy configuration). After 10 retries (~5 min), program continues with an error log instead of blocking. Fixes #955 (comment) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 609aa9b commit 683e272

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

backend/src/module/core/program.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,21 @@ async def startup(self):
7171
async def start(self):
7272
self.stop_event.clear()
7373
settings.load()
74+
max_retries = 10
75+
retry_count = 0
7476
while not await self.check_downloader_status():
75-
logger.warning("Downloader is not running.")
76-
logger.info("Waiting for downloader to start.")
77+
retry_count += 1
78+
logger.warning(
79+
f"Downloader is not running. (attempt {retry_count}/{max_retries})"
80+
)
81+
if retry_count >= max_retries:
82+
logger.error(
83+
"Failed to connect to downloader after maximum retries. "
84+
"Please check downloader settings and network/proxy configuration. "
85+
"Program will continue but download functions will not work."
86+
)
87+
break
88+
logger.info("Waiting for downloader to start...")
7789
await asyncio.sleep(30)
7890
if self.enable_renamer:
7991
self.rename_start()

0 commit comments

Comments
 (0)