Skip to content

Commit

Permalink
Add wait for server death back
Browse files Browse the repository at this point in the history
  • Loading branch information
emnigma committed Aug 12, 2023
1 parent 6963e82 commit ca8ac5b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions VSharp.ML.AIAgent/launch_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,22 @@ def kill_server(server_instance: ServerInstanceInfo):
os.kill(server_instance.pid, signal.SIGKILL)
PROCS.remove(server_instance.pid)

wait_for_reset_retries = FeatureConfig.ON_GAME_SERVER_RESTART.wait_for_reset_retries
while wait_for_reset_retries:
logging.info(
f"Waiting for {server_instance} to die, {wait_for_reset_retries} retries left"
)
if psutil.Process(server_instance.pid).status() in (
psutil.STATUS_DEAD,
psutil.STATUS_ZOMBIE,
):
break
time.sleep(FeatureConfig.ON_GAME_SERVER_RESTART.wait_for_reset_time)
wait_for_reset_retries -= 1

if wait_for_reset_retries == 0:
raise RuntimeError(f"{server_instance} could not be killed")

logging.info(f"killed {psutil.Process(server_instance.pid)}")


Expand Down

0 comments on commit ca8ac5b

Please sign in to comment.