Ignore instance status changes that didn't change

Check if the instance status in the instanceStatusChanged event actually
changed and ignore the event if it didn't.  This prevents bogus updates
from being pushed to control clients and plugins.
This commit is contained in:
Hornwitser committed 2021-05-21 17:27:25 +02:00
1 parent 6ffcb8c451
commit 177278fee3
1 file changed
+9
+9
View File
@@ -62,6 +62,15 @@ class SlaveConnection extends BaseConnection {
return;
}
// We may receive status changed where the status hasn't changed
// from our perspective if the connection was down at the time it
// changed. Slaves also send status updates on assignInstance which
// for hacky reason is also used to push config changes and
// restablish status after a connection loss.
if (instance.status === message.data.status) {
return;
}
let prev = instance.status;
instance.status = message.data.status;
logger.verbose(`Instance ${instance.config.get("instance.name")} State: ${instance.status}`);