Skip to content

Commit

Permalink
chore(emu): wipe storage when changing the model
Browse files Browse the repository at this point in the history
  • Loading branch information
grdddj committed Oct 23, 2023
1 parent 89ae1fd commit bca585d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
user="rpc",
passwd="rpc",
)
PREV_RUNNING_MODEL: str = ""


def is_regtest_active() -> bool:
Expand Down Expand Up @@ -136,6 +137,8 @@ def run_bridge_command(self) -> dict:
}

def run_emulator_command(self) -> dict:
global PREV_RUNNING_MODEL

# The versions are sorted, the first one is the current master
# build and then the rest by version number.
# Not supplying any version will result in "2-master",
Expand All @@ -158,6 +161,9 @@ def run_emulator_command(self) -> dict:
wipe = self.request_dict.get("wipe", False)
output_to_logfile = self.request_dict.get("output_to_logfile", True)
save_screenshots = self.request_dict.get("save_screenshots", False)
if model != PREV_RUNNING_MODEL:
wipe = True
PREV_RUNNING_MODEL = model # type: ignore
emulator.start(
version=version,
model=model,
Expand All @@ -175,6 +181,9 @@ def run_emulator_command(self) -> dict:
wipe = self.request_dict.get("wipe", False)
output_to_logfile = self.request_dict.get("output_to_logfile", True)
save_screenshots = self.request_dict.get("save_screenshots", False)
if model != PREV_RUNNING_MODEL:
wipe = True
PREV_RUNNING_MODEL = model # type: ignore
emulator.start_from_url(
url=url,
model=model,
Expand Down

0 comments on commit bca585d

Please sign in to comment.