From 0165ff8f47b5a36ecad1ae96c3a2707c01078f4c Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Wed, 12 Jun 2024 02:14:30 +0200 Subject: [PATCH] SC2: don't close all SC2 instances when one quits (#3507) --- worlds/_sc2common/bot/sc2process.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/worlds/_sc2common/bot/sc2process.py b/worlds/_sc2common/bot/sc2process.py index e36632165979..f74ed9c18f9f 100644 --- a/worlds/_sc2common/bot/sc2process.py +++ b/worlds/_sc2common/bot/sc2process.py @@ -28,6 +28,11 @@ def add(cls, value): logger.debug("kill_switch: Add switch") cls._to_kill.append(value) + @classmethod + def kill(cls, value): + logger.info(f"kill_switch: Process cleanup for 1 process") + value._clean(verbose=False) + @classmethod def kill_all(cls): logger.info(f"kill_switch: Process cleanup for {len(cls._to_kill)} processes") @@ -116,7 +121,7 @@ def signal_handler(*_args): async def __aexit__(self, *args): logger.exception("async exit") await self._close_connection() - kill_switch.kill_all() + kill_switch.kill(self) signal.signal(signal.SIGINT, signal.SIG_DFL) @property