's'
This commit is contained in:
17
web.py
17
web.py
@@ -342,12 +342,17 @@ async def lifespan(app: FastAPI):
|
||||
except Exception:
|
||||
# PM2/Shell 异常时不阻塞整站启动(否则反代持续 502)
|
||||
pass
|
||||
try:
|
||||
ok, msg = await asyncio.to_thread(ensure_scrcpy_jar, BASE_DIR)
|
||||
if not ok:
|
||||
print(f"[web] scrcpy-server: {msg}", file=sys.stderr)
|
||||
except Exception as exc:
|
||||
print(f"[web] scrcpy-server bootstrap: {exc}", file=sys.stderr)
|
||||
|
||||
# scrcpy-server 下载可走外网重试,勿阻塞启动;否则 systemd 默认 TimeoutStartSec≈90s 会杀进程,:8001 永不起
|
||||
async def _bootstrap_scrcpy() -> None:
|
||||
try:
|
||||
ok, msg = await asyncio.to_thread(ensure_scrcpy_jar, BASE_DIR)
|
||||
if not ok:
|
||||
print(f"[web] scrcpy-server: {msg}", file=sys.stderr)
|
||||
except Exception as exc:
|
||||
print(f"[web] scrcpy-server bootstrap: {exc}", file=sys.stderr)
|
||||
|
||||
asyncio.create_task(_bootstrap_scrcpy())
|
||||
yield
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user