fix(async): offload file metadata checks

This commit is contained in:
InfinityPacer
2026-08-23 12:06:52 +08:00
parent 56293bc82a
commit e8cfe272c4
9 changed files with 182 additions and 12 deletions
+6 -1
View File
@@ -9,6 +9,8 @@ from pathlib import Path
from typing import Any, Optional, Tuple, Union
from uuid import UUID
from fastapi.concurrency import run_in_threadpool
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
@@ -137,7 +139,10 @@ class AcoustIdModule(_ModuleBase):
) -> Optional[str]:
"""异步读取音频指纹并返回高置信匹配的 MusicBrainz Recording ID。"""
file_path = Path(path)
if not self._fpcalc_path or not file_path.is_file():
if not self._fpcalc_path or not await run_in_threadpool(
Path.is_file,
file_path,
):
return None
cache_key = self._file_cache_key(file_path)
if cache_key: