Skip to content

Commit 7362197

Browse files
committed
Cold shutdown does not restart
1 parent 9e9f6a3 commit 7362197

File tree

1 file changed

+6
-33
lines changed

1 file changed

+6
-33
lines changed

server/resources/shutdown_resources.py

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -39,44 +39,17 @@ def post(self):
3939

4040
preserve_reading_state = get_boolean_param("preserve_reading_state", default=False)
4141
mark_for_restart = get_boolean_param("mark_for_restart", default=False)
42-
cold_restart = get_boolean_param("cold", default=False)
42+
cold = get_boolean_param("cold", default=False)
4343

4444
try:
4545
# Use the shutdown manager to handle the shutdown
4646
shutdown_summary = self.shutdown_manager.shutdown_emulator(
4747
sindarin_email,
4848
preserve_reading_state=preserve_reading_state,
49-
mark_for_restart=mark_for_restart or cold_restart, # Mark for restart if cold boot requested
50-
skip_snapshot=cold_restart, # Skip snapshot if cold boot requested
49+
mark_for_restart=mark_for_restart,
50+
skip_snapshot=cold, # Skip snapshot if cold shutdown requested
5151
)
5252

53-
# If cold restart requested, restart the emulator with cold boot
54-
if cold_restart:
55-
logger.info(f"Cold restart requested for {sindarin_email}, restarting emulator...")
56-
# Import here to avoid circular imports
57-
from views.core.avd_profile_manager import AVDProfileManager
58-
59-
avd_manager = AVDProfileManager.get_instance()
60-
if (
61-
avd_manager
62-
and avd_manager.emulator_manager
63-
and avd_manager.emulator_manager.emulator_launcher
64-
):
65-
# Start the emulator with cold boot flag
66-
(
67-
success,
68-
emulator_id,
69-
display_num,
70-
) = avd_manager.emulator_manager.emulator_launcher.launch_emulator(
71-
sindarin_email, cold_boot=True
72-
)
73-
if success:
74-
logger.info(f"Successfully restarted emulator {emulator_id} with cold boot")
75-
shutdown_summary["cold_restarted"] = True
76-
else:
77-
logger.error(f"Failed to restart emulator with cold boot for {sindarin_email}")
78-
shutdown_summary["cold_restarted"] = False
79-
8053
# Prepare response
8154
message_parts = []
8255
if shutdown_summary["emulator_stopped"]:
@@ -89,8 +62,8 @@ def post(self):
8962
message_parts.append("automator cleaned")
9063
if shutdown_summary["snapshot_taken"]:
9164
message_parts.append("snapshot taken")
92-
if shutdown_summary.get("cold_restarted"):
93-
message_parts.append("emulator restarted with cold boot")
65+
elif cold:
66+
message_parts.append("snapshot skipped for cold boot")
9467

9568
if message_parts:
9669
message = f"Successfully shut down for {sindarin_email}: {', '.join(message_parts)}"
@@ -101,7 +74,7 @@ def post(self):
10174
"success": True,
10275
"message": message,
10376
"details": shutdown_summary,
104-
"cold_restart": cold_restart,
77+
"cold_shutdown": cold,
10578
}, 200
10679

10780
except Exception as e:

0 commit comments

Comments
 (0)