Skip to content

Commit 2bce106

Browse files
committed
Start 0.0.4
1 parent c662b65 commit 2bce106

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

chaos-runner/src/examples/java/io/synadia/examples/ChaosRunnerExample.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,25 @@ public static void main(String[] args) throws Exception {
6969
int[] monitorPorts = runner.getMonitorPorts();
7070
boolean hasMonitor = monitorPorts[0] > 0;
7171

72-
String[] reports = new String[ports.length];
72+
String[] hzs = new String[ports.length];
7373
while (true) {
7474
Thread.sleep(HEALTH_CHECK_DELAY);
7575
if (hasMonitor) {
76-
report("HealthZ");
76+
boolean changed = false;
7777
for (int i = 0; i < monitorPorts.length; i++) {
78-
int port = ports[i];
79-
int mport = monitorPorts[i];
80-
report(" ", port + "/" + mport, readHealthz(mport));
78+
String hz = readHealthz(monitorPorts[i]);
79+
if (!hz.equals(hzs[i])) {
80+
changed = true;
81+
hzs[i] = hz;
82+
}
83+
}
84+
if (changed) {
85+
report("HealthZ");
86+
for (int i = 0; i < monitorPorts.length; i++) {
87+
int port = ports[i];
88+
int mport = monitorPorts[i];
89+
report(" ", port + "/" + mport, hzs[i]);
90+
}
8191
}
8292
}
8393
}

0 commit comments

Comments
 (0)