mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 15:33:12 +09:00
Add recovery startup mode (#757)
* Add recovery startup mode * Change error code to RecoveryMode
This commit is contained in:
1 parent
7cf13a8b3b
commit
be071be8f2
7 files changed
+58
No files matched your search
@@ -298,6 +298,11 @@ export default class Host extends lib.Link {
|
||||
* will restart this host on a non-zero exit codes.
|
||||
*/
|
||||
public canRestart = false,
|
||||
/**
|
||||
* If true indicates the host is in recovery mode and should
|
||||
* disable certain actions such as loading plugins or instance autostart
|
||||
*/
|
||||
public recoveryMode = false,
|
||||
public modStore = new lib.ModStore(hostConfig.get("host.mods_directory"), new Map()),
|
||||
) {
|
||||
super(connector);
|
||||
@@ -403,6 +408,11 @@ export default class Host extends lib.Link {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.recoveryMode) {
|
||||
logger.warn(`Recovery | force disabled plugin ${pluginInfo.name}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
let HostPluginClass = BaseHostPlugin;
|
||||
try {
|
||||
if (pluginInfo.hostEntrypoint) {
|
||||
@@ -1080,6 +1090,10 @@ export default class Host extends lib.Link {
|
||||
|
||||
for (let [instanceId, instanceInfo] of this.instanceInfos) {
|
||||
if (instanceInfo.config.get("instance.auto_start")) {
|
||||
if (this.recoveryMode) {
|
||||
logger.warn(`Recovery | skipping auto startup for ${instanceInfo.config.get("instance.name")}`);
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
let instanceConnection = await this._connectInstance(instanceId);
|
||||
await instanceConnection.instance.handleInstanceStartRequest(new lib.InstanceStartRequest());
|
||||
|
||||
@@ -646,6 +646,11 @@ end`.replace(/\r?\n/g, " ");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this._host.recoveryMode) {
|
||||
this.logger.warn(`Recovery | force disabled plugin ${pluginInfo.name}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
await this._loadPlugin(pluginInfo, this._host);
|
||||
} catch (err) {
|
||||
|
||||
Reference in new issue
Block a user