@@ -139,25 +139,33 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che
139
139
double bytesSentPerSecond = 0 ;
140
140
double bytesReceivedPerSecond = 0 ;
141
141
142
- for (const Endpoint::Ptr & endpoint : zone->GetEndpoints ()) {
143
- if (endpoint->GetConnected ())
144
- connected = true ;
142
+ {
143
+ auto endpoints (zone->GetEndpoints ());
144
+
145
+ for (const Endpoint::Ptr & endpoint : endpoints) {
146
+ if (endpoint->GetConnected ())
147
+ connected = true ;
148
+
149
+ double eplag = ApiListener::CalculateZoneLag (endpoint);
145
150
146
- double eplag = ApiListener::CalculateZoneLag (endpoint);
151
+ if (eplag > 0 && eplag > zoneLag)
152
+ zoneLag = eplag;
147
153
148
- if (eplag > 0 && eplag > zoneLag )
149
- zoneLag = eplag ;
154
+ if (endpoint-> GetLastMessageSent () > lastMessageSent )
155
+ lastMessageSent = endpoint-> GetLastMessageSent () ;
150
156
151
- if (endpoint->GetLastMessageSent () > lastMessageSent )
152
- lastMessageSent = endpoint->GetLastMessageSent ();
157
+ if (endpoint->GetLastMessageReceived () > lastMessageReceived )
158
+ lastMessageReceived = endpoint->GetLastMessageReceived ();
153
159
154
- if (endpoint->GetLastMessageReceived () > lastMessageReceived)
155
- lastMessageReceived = endpoint->GetLastMessageReceived ();
160
+ messagesSentPerSecond += endpoint->GetMessagesSentPerSecond ();
161
+ messagesReceivedPerSecond += endpoint->GetMessagesReceivedPerSecond ();
162
+ bytesSentPerSecond += endpoint->GetBytesSentPerSecond ();
163
+ bytesReceivedPerSecond += endpoint->GetBytesReceivedPerSecond ();
164
+ }
156
165
157
- messagesSentPerSecond += endpoint->GetMessagesSentPerSecond ();
158
- messagesReceivedPerSecond += endpoint->GetMessagesReceivedPerSecond ();
159
- bytesSentPerSecond += endpoint->GetBytesSentPerSecond ();
160
- bytesReceivedPerSecond += endpoint->GetBytesReceivedPerSecond ();
166
+ if (!connected && endpoints.size () == 1u && *endpoints.begin () == Endpoint::GetLocalEndpoint ()) {
167
+ connected = true ;
168
+ }
161
169
}
162
170
163
171
ServiceState state;
0 commit comments