fix: prevent restart downgrades (#951)

Co-authored-by: Loi Nguyen <1948922+lntutor@users.noreply.github.com>
This commit is contained in:
Loi NguyenandLoi Nguyen authored and GitHub committed 2026-07-26 12:20:22 +01:00
1 parent 9ff090c30b
commit 08651b5917
7 files changed
+189 -1

No files matched your search

@@ -189,6 +189,15 @@ export default class ControlConnection extends BaseConnection {
if (!this._controller.canRestart) {
throw new lib.RequestError("Cannot restart, controller does not have a process monitor to restart it.");
}
const downgrade = await this._controller.checkRestartDowngrade();
if (downgrade) {
const { installedVersion, runningVersion } = downgrade;
throw new lib.RequestError(
`Cannot restart controller with installed Clusterio version ${installedVersion} because it ` +
`is older than running version ${runningVersion}. ` +
"Stop the controller before starting the older version manually."
);
}
this._controller.shouldRestart = true;
this._controller.stop();
}