fix: recycle webpool container on TERMINATED sessions too

terminate_session_record was explicitly skipping WEBPOOLIDX containers.
Now stops portal-webpool-N in a background thread on any session close,
so ensure_web_pool recreates it fresh for the next user.
This commit is contained in:
2026-07-22 08:10:20 +00:00
parent ca5d1af2b5
commit c58ed04821
+9 -2
View File
@@ -745,8 +745,15 @@ def terminate_session_record(
return
old_status = sess.status
cid = sess.container_id or ""
if stop_container and cid and not cid.startswith(("POOL:", "POOLIDX:", "WEBPOOLIDX:", "RDPSLOT:")):
stop_runtime_container(cid)
if stop_container and cid:
if cid.startswith("WEBPOOLIDX:"):
try:
slot = int(cid.split(":", 1)[1])
threading.Thread(target=stop_runtime_container, args=(web_pool_container_name(slot),), daemon=True).start()
except Exception:
logger.exception("webpool_slot_recycle_failed cid=%s", cid)
elif not cid.startswith(("POOL:", "POOLIDX:", "RDPSLOT:")):
stop_runtime_container(cid)
if cid.startswith("RDPSLOT:"):
try:
slot_id = int(cid.split(":", 1)[1])