diff --git a/dashboard/backend/routers/terminal.py b/dashboard/backend/routers/terminal.py index 04b5249..c87558a 100644 --- a/dashboard/backend/routers/terminal.py +++ b/dashboard/backend/routers/terminal.py @@ -10,7 +10,6 @@ import config logger = logging.getLogger(__name__) MAX_SESSIONS = 5 -IDLE_TIMEOUT = 30 * 60 # 30 minutes _active_sessions: set = set() HOSTS = { @@ -95,18 +94,10 @@ async def ws_endpoint(websocket: WebSocket, host: str = Query("nas")): pass read_task = asyncio.create_task(read_ssh()) - last_activity = time.monotonic() try: while True: - try: - msg = await asyncio.wait_for(websocket.receive(), timeout=60) - except asyncio.TimeoutError: - if time.monotonic() - last_activity > IDLE_TIMEOUT: - await websocket.close(code=1000, reason="Idle timeout") - break - continue - last_activity = time.monotonic() + msg = await websocket.receive() if "bytes" in msg and msg["bytes"]: data = msg["bytes"] if data[0:1] == b"\x01" and len(data) == 5: