Set status to unknown on slave disconnect

Change the instance status to unknown if the slave it's connected to
is disconnected rather than leaving them at their previous state
indefinitely.
This commit is contained in:
Hornwitser committed 2021-09-11 17:12:06 +02:00
1 parent c9ae964eee
commit c59267d5ee
3 files changed
+21 -2

No files matched your search

+14
View File
@@ -39,6 +39,20 @@ class SlaveConnection extends BaseConnection {
}
});
}
this.connector.on("close", () => {
// Update status to unknown for instances on this slave.
for (let instance of this._master.instances.values()) {
if (instance.config.get("instance.assigned_slave") !== this._id) {
continue;
}
let prev = instance.status;
instance.status = "unknown";
this._master.instanceUpdated(instance);
libPlugin.invokeHook(this._master.plugins, "onInstanceStatusChanged", instance, prev);
}
});
}
/**