mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-23 10:00:57 +08:00
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>
This commit is contained in:
@@ -71,9 +71,21 @@ class Program(RenameThread, RSSThread):
|
||||
async def start(self):
|
||||
self.stop_event.clear()
|
||||
settings.load()
|
||||
max_retries = 10
|
||||
retry_count = 0
|
||||
while not await self.check_downloader_status():
|
||||
logger.warning("Downloader is not running.")
|
||||
logger.info("Waiting for downloader to start.")
|
||||
retry_count += 1
|
||||
logger.warning(
|
||||
f"Downloader is not running. (attempt {retry_count}/{max_retries})"
|
||||
)
|
||||
if retry_count >= max_retries:
|
||||
logger.error(
|
||||
"Failed to connect to downloader after maximum retries. "
|
||||
"Please check downloader settings and network/proxy configuration. "
|
||||
"Program will continue but download functions will not work."
|
||||
)
|
||||
break
|
||||
logger.info("Waiting for downloader to start...")
|
||||
await asyncio.sleep(30)
|
||||
if self.enable_renamer:
|
||||
self.rename_start()
|
||||
|
||||
Reference in New Issue
Block a user