Fix: update command err

This commit is contained in:
unitwk 2024-04-21 12:46:10 +08:00
parent 375dc888eb
commit e925dccf61
4 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,7 @@ export default class GeneralUpdateCommand extends InstanceCommand {
async exec(instance: Instance) {
if (instance.status() !== Instance.STATUS_STOP)
return instance.failure(new Error($t("TXT_CODE_general_update.statusErr_notStop")));
if (instance.asynchronousTask !== null)
if (instance.asynchronousTask)
return instance.failure(new Error($t("TXT_CODE_general_update.statusErr_otherProgress")));
try {
instance.setLock(true);
@ -100,6 +100,7 @@ export default class GeneralUpdateCommand extends InstanceCommand {
}
async stop(instance: Instance): Promise<void> {
instance.asynchronousTask = undefined;
logger.info(
$t("TXT_CODE_general_update.terminateUpdate", { instanceUuid: instance.instanceUuid })
);
@ -114,6 +115,5 @@ export default class GeneralUpdateCommand extends InstanceCommand {
if (this.pid && this.process) {
killProcess(this.pid, this.process);
}
instance.asynchronousTask = undefined;
}
}

View File

@ -49,7 +49,7 @@ export default class Instance extends EventEmitter {
public lock: boolean = false;
public startCount: number = 0;
public startTimestamp: number = 0;
public asynchronousTask?: IExecutable;
public asynchronousTask?: IExecutable | null;
public openFrp?: OpenFrp;
public readonly lifeCycleTaskManager = new LifeCycleTaskManager(this);

View File

@ -1873,5 +1873,5 @@
"TXT_CODE_31c5a4d0": "Web Shell",
"TXT_CODE_f25df30a": "Terraria",
"TXT_CODE_693f31d6": "Path Prefix",
"TXT_CODE_3e93e31e": "Leave it blank if not set."
"TXT_CODE_3e93e31e": "Used when reusing ports. In most cases, no configuration is required here"
}

View File

@ -1873,5 +1873,5 @@
"TXT_CODE_31c5a4d0": "Web Shell",
"TXT_CODE_f25df30a": "泰拉瑞亚",
"TXT_CODE_693f31d6": "路径前缀",
"TXT_CODE_3e93e31e": "如果没有设置请留空。"
"TXT_CODE_3e93e31e": "共用端口时使用,通常情况下此处无需配置"
}