mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-31 01:24:19 +02:00
ApiListener#ReplayLog(): stop reading files ASAP on send error
This commit is contained in:
parent
a6946f9dbf
commit
9a0c7d7c75
@ -1459,7 +1459,9 @@ void ApiListener::ReplayLog(const JsonRpcConnection::Ptr& client)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
bool stopReplay = false;
|
||||||
|
|
||||||
|
do {
|
||||||
std::unique_lock<std::mutex> lock(m_LogLock);
|
std::unique_lock<std::mutex> lock(m_LogLock);
|
||||||
|
|
||||||
CloseLogFile();
|
CloseLogFile();
|
||||||
@ -1542,6 +1544,7 @@ void ApiListener::ReplayLog(const JsonRpcConnection::Ptr& client)
|
|||||||
Log(LogDebug, "ApiListener")
|
Log(LogDebug, "ApiListener")
|
||||||
<< "Error while replaying log for endpoint '" << endpoint->GetName() << "': " << DiagnosticInformation(ex);
|
<< "Error while replaying log for endpoint '" << endpoint->GetName() << "': " << DiagnosticInformation(ex);
|
||||||
|
|
||||||
|
stopReplay = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1563,6 +1566,10 @@ void ApiListener::ReplayLog(const JsonRpcConnection::Ptr& client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
logStream->Close();
|
logStream->Close();
|
||||||
|
|
||||||
|
if (stopReplay) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
@ -1575,16 +1582,14 @@ void ApiListener::ReplayLog(const JsonRpcConnection::Ptr& client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (last_sync) {
|
if (last_sync) {
|
||||||
{
|
|
||||||
ObjectLock olock2(endpoint);
|
|
||||||
endpoint->SetSyncing(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
OpenLogFile();
|
OpenLogFile();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} while (!stopReplay);
|
||||||
|
|
||||||
|
ObjectLock olock2 (endpoint);
|
||||||
|
endpoint->SetSyncing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiListener::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
|
void ApiListener::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user