diff --git a/app/main.py b/app/main.py index e857f53..e103261 100644 --- a/app/main.py +++ b/app/main.py @@ -13,7 +13,6 @@ from fastapi.responses import HTMLResponse, JSONResponse, RedirectResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates from markupsafe import Markup, escape -from sqlalchemy import select from sqlalchemy import delete, select, text, update from sqlalchemy.orm import Session from starlette.responses import HTMLResponse as _HR @@ -151,7 +150,6 @@ _tg_poll_lock_file = None async def _telegram_poll_loop(): """Poll Telegram for callback_query updates every 5 minutes.""" import asyncio as _asyncio - import json as _jp global _tg_poll_offset await _asyncio.sleep(10) # wait for app to fully start while True: diff --git a/app/runtime.py b/app/runtime.py index ae70e1a..09fce29 100644 --- a/app/runtime.py +++ b/app/runtime.py @@ -701,27 +701,6 @@ def disconnect_rdp_slot(slot_id: int) -> None: db.close() -def _restart_rdp_slot_bg(slot_id: int) -> None: - db = SessionLocal() - try: - slot = db.get(RdpSlot, slot_id) - if not slot or not slot.container_name: - return - service = db.get(Service, slot.service_id) - if not service: - return - try: - d = docker_client() - c = d.containers.get(slot.container_name) - c.restart(timeout=10) - logger.info("rdp_slot_container_restarted slot_id=%s", slot_id) - except docker.errors.NotFound: - start_rdp_slot_container(slot, service) - except Exception: - logger.exception("rdp_slot_container_restart_failed slot_id=%s", slot_id) - finally: - db.close() - def stop_runtime_container(container_id: Optional[str]) -> None: if not container_id: @@ -1093,8 +1072,6 @@ def allocator_lock(db: Session, lock_id: int, timeout_seconds: Optional[float] = time.sleep(max(0.01, poll_seconds)) raise LockTimeoutError(f"advisory lock timeout lock_id={lock_id} timeout={timeout_seconds}") - return self_nonlocal - def __exit__(self_nonlocal, exc_type, exc, tb): return False