Skip to content

Commit 8d58469

Browse files
committed
Bugfix on node states.
1 parent de5c923 commit 8d58469

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ const seconds = parseInt((process.env.MONO_PERIOD || 3));
2222
const time = seconds * 1000;
2323

2424
if (isAlways) {
25-
console.log(`--always is enabled which means every ${seconds} your service will be informed.`);
25+
console.log(`--always is enabled which means every ${seconds} seconds your service will be informed.`);
2626
} else {
27-
console.log(`Your service will be informed every ${seconds} when something is changed.`);
27+
console.log(`Your service will be informed every ${seconds} seconds when something is changed.`);
2828
}
2929

3030
const serviceUrl = process.env.MONO_SERVICE;
@@ -53,7 +53,9 @@ const main = async () => {
5353
nnodes[x.ID] = {
5454
Id: x.ID,
5555
Name: x.Description.Hostname,
56-
Ip: x.Status.Addr
56+
Ip: x.Status.Addr,
57+
State: x.Status.State,
58+
Availability: x.Spec.Availability
5759
};
5860
});
5961

@@ -88,7 +90,7 @@ const main = async () => {
8890

8991
let node = nnodes[x.NodeID];
9092

91-
if (!node) {
93+
if (!node || node.State !== NODE_STATES.READY || node.Availability !== NODE_STATES.ACTIVE) {
9294
return;
9395
}
9496

0 commit comments

Comments
 (0)