V45.39: fix SERVER OFFLINE lau + UI load cham - engine ghi port file (engine_port.txt), UI bootstrap doc port engine cua chinh no (get_engine_port) + timeout/retry 60s, health poll self-heal reload, khong taskkill /IM daw_engine (giet engine instance khac), /api/v1/plugins/available chay scan trong threadpool (khong chan event loop -> /health het timeout)

This commit is contained in:
2026-09-01 16:45:06 +07:00
parent 1e0314249d
commit 2c4d6c358b
7 changed files with 2849 additions and 2756 deletions
+8
View File
@@ -194,6 +194,14 @@ def get_scanner():
@router.get("/available")
async def list_plugins(current_user: dict = Depends(get_current_user)):
# Scan VST/SF chạy subprocess đồng bộ (fx_vst_bridge --scan, timeout 300s/
# dir; Ozone treo tới 30s/module) — chạy trực tiếp trên event loop sẽ chặn
# /health và mọi request khác → UI báo SERVER: OFFLINE suốt thời gian scan.
# Chạy trong threadpool để event loop luôn phản hồi.
return await asyncio.to_thread(_list_plugins_impl)
def _list_plugins_impl():
d = _effective_dirs()
pm = PluginManager(vst_dir=d["vst_dir"], sf_dir=d["soundfont_dir"], upload_sf_dir=UPLOAD_SF_DIR, extra_vst_dirs=d["plugin_dirs"], user_dirs_override=d.get("plugin_dirs_user_set", False))
avail = pm.list_available()