mirror of
https://github.com/Hommy-master/capcut-mate.git
synced 2026-09-01 15:32:57 +08:00
解决内存泄漏的问题。
This commit is contained in:
@@ -457,6 +457,7 @@ def _assess_network_quality(url: str) -> str:
|
||||
Returns:
|
||||
str: 网络质量 ('good', 'medium', 'poor')
|
||||
"""
|
||||
response = None
|
||||
try:
|
||||
# 兼容 pydantic HttpUrl 等对象,避免出现 decode 属性错误
|
||||
url = str(url)
|
||||
@@ -488,6 +489,12 @@ def _assess_network_quality(url: str) -> str:
|
||||
except Exception as e:
|
||||
logger.info(f"Failed to assess network quality, fallback to poor: {e}")
|
||||
return 'poor' # 默认为较差的网络环境
|
||||
finally:
|
||||
if response is not None:
|
||||
try:
|
||||
response.close()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def _check_range_support_with_retry(url: str, max_retries: int = 2) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user