Skip to content

Commit 244c51f

Browse files
authored
🐛 fix: catch semaphore error to improve download stability (#380)
1 parent 37394a2 commit 244c51f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/yutto/utils/fetcher.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ async def download_file_with_offset(
236236
error_type = e.__class__.__name__
237237
Logger.warning(f"文件 {file_buffer.file_path} 下载出错({error_type}),尝试重新连接...")
238238
Logger.debug(f"超时链接:{url}")
239+
except ValueError as e:
240+
# 由于 httpx 经常出现此问题,暂时捕获该问题
241+
if "semaphore released too many times" not in str(e):
242+
raise e
243+
Logger.warning(f"文件 {file_buffer.file_path} 下载出错({e}),尝试重新连接...")
239244

240245

241246
def create_client(

0 commit comments

Comments
 (0)