mirror of https://github.com/Icinga/icinga2.git
cluster: Prevent message loops when replaying logs.
This commit is contained in:
parent
8e381e0298
commit
b97e69604d
|
@ -208,6 +208,10 @@ void ClusterComponent::RelayMessage(const Endpoint::Ptr& except, const Dictionar
|
||||||
Dictionary::Ptr pmessage = boost::make_shared<Dictionary>();
|
Dictionary::Ptr pmessage = boost::make_shared<Dictionary>();
|
||||||
double ts = Utility::GetTime();
|
double ts = Utility::GetTime();
|
||||||
pmessage->Set("timestamp", ts);
|
pmessage->Set("timestamp", ts);
|
||||||
|
|
||||||
|
if (except)
|
||||||
|
pmessage->Set("except", except->GetName());
|
||||||
|
|
||||||
pmessage->Set("message", message);
|
pmessage->Set("message", message);
|
||||||
|
|
||||||
ObjectLock olock(this);
|
ObjectLock olock(this);
|
||||||
|
@ -320,6 +324,9 @@ void ClusterComponent::ReplayLog(const Endpoint::Ptr& endpoint, const Stream::Pt
|
||||||
if (pmessage->Get("timestamp") < endpoint->GetLocalLogPosition())
|
if (pmessage->Get("timestamp") < endpoint->GetLocalLogPosition())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (pmessage->Get("except") == endpoint->GetName())
|
||||||
|
continue;
|
||||||
|
|
||||||
String json = Value(pmessage->Get("message")).Serialize();
|
String json = Value(pmessage->Get("message")).Serialize();
|
||||||
NetString::WriteStringToStream(stream, json);
|
NetString::WriteStringToStream(stream, json);
|
||||||
count++;
|
count++;
|
||||||
|
|
Loading…
Reference in New Issue