Fix: [ALAS] Device.__init__() was never called if EmulatorNotRunningError handled

This commit is contained in:
LmeSzinc 2024-07-23 21:21:10 +08:00
parent 3180e10356
commit 37d45af63f
2 changed files with 6 additions and 3 deletions

View File

@ -71,11 +71,14 @@ class Device(Screenshot, Control, AppControl):
stuck_timer = Timer(60, count=60).start() stuck_timer = Timer(60, count=60).start()
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
for _ in range(2): for trial in range(4):
try: try:
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
break break
except EmulatorNotRunningError: except EmulatorNotRunningError:
if trial >= 3:
logger.critical('Failed to start emulator after 3 trial')
raise RequestHumanTakeover
# Try to start emulator # Try to start emulator
if self.emulator_instance is not None: if self.emulator_instance is not None:
self.emulator_start() self.emulator_start()
@ -84,7 +87,7 @@ class Device(Screenshot, Control, AppControl):
f'No emulator with serial "{self.config.Emulator_Serial}" found, ' f'No emulator with serial "{self.config.Emulator_Serial}" found, '
f'please set a correct serial' f'please set a correct serial'
) )
raise raise RequestHumanTakeover
# Auto-fill emulator info # Auto-fill emulator info
if IS_WINDOWS and self.config.EmulatorInfo_Emulator == 'auto': if IS_WINDOWS and self.config.EmulatorInfo_Emulator == 'auto':

View File

@ -221,7 +221,7 @@ class PlatformWindows(PlatformBase, EmulatorManager):
logger.info(f'Found azurlane packages: {m}') logger.info(f'Found azurlane packages: {m}')
interval = Timer(0.5).start() interval = Timer(0.5).start()
timeout = Timer(300).start() timeout = Timer(180).start()
new_window = 0 new_window = 0
while 1: while 1:
interval.wait() interval.wait()