a3216 commited on
Commit
dc599fb
·
verified ·
1 Parent(s): 48d810d

sync from GitHub 1362c47: feat: update version code and enhance backup system

Browse files
Files changed (1) hide show
  1. app/api/user_backups_v6.py +3 -1
app/api/user_backups_v6.py CHANGED
@@ -354,7 +354,9 @@ async def download_blob(key: str, request: Request):
354
  raise _err("unauthorized", "missing user", status=401)
355
  if not _is_sha256_hex(key):
356
  raise _err("invalid_key", "key 必须是 64 位 sha256 hex", status=400)
357
- blob_path = backup_v6_store.get_blob_local_path(key)
 
 
358
  if not blob_path or not blob_path.exists():
359
  raise _err("blob_not_found", "blob 不存在", status=404)
360
  meta = backup_v6_store.get_blob_meta(key)
 
354
  raise _err("unauthorized", "missing user", status=401)
355
  if not _is_sha256_hex(key):
356
  raise _err("invalid_key", "key 必须是 64 位 sha256 hex", status=400)
357
+ # get_blob_local_path 本地缺失时会同步走 Hub 回源(网络 IO),
358
+ # 必须放 to_thread,否则阻塞事件循环拖垮整个服务
359
+ blob_path = await asyncio.to_thread(backup_v6_store.get_blob_local_path, key)
360
  if not blob_path or not blob_path.exists():
361
  raise _err("blob_not_found", "blob 不存在", status=404)
362
  meta = backup_v6_store.get_blob_meta(key)