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
+8 -1
View File
@@ -745,7 +745,14 @@ def terminate_session_record(
return return
old_status = sess.status old_status = sess.status
cid = sess.container_id or "" cid = sess.container_id or ""
if stop_container and cid and not cid.startswith(("POOL:", "POOLIDX:", "WEBPOOLIDX:", "RDPSLOT:")): 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) stop_runtime_container(cid)
if cid.startswith("RDPSLOT:"): if cid.startswith("RDPSLOT:"):
try: try: