mirror of https://github.com/Icinga/icinga2.git
Make sure log file is reopened when `ApiListener::ReplayLog()` returns
This commit is contained in:
parent
a5a83e311a
commit
9222a63ff7
|
@ -1466,12 +1466,14 @@ void ApiListener::ReplayLog(const JsonRpcConnection::Ptr& client)
|
||||||
std::unique_lock<std::mutex> lock(m_LogLock);
|
std::unique_lock<std::mutex> lock(m_LogLock);
|
||||||
|
|
||||||
CloseLogFile();
|
CloseLogFile();
|
||||||
|
Defer reopenLog;
|
||||||
|
|
||||||
if (count == -1 || count > 50000) {
|
if (count == -1 || count > 50000) {
|
||||||
OpenLogFile();
|
OpenLogFile();
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
} else {
|
} else {
|
||||||
last_sync = true;
|
last_sync = true;
|
||||||
|
reopenLog.SetFunc([this]() { OpenLogFile(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
|
@ -1577,8 +1579,6 @@ void ApiListener::ReplayLog(const JsonRpcConnection::Ptr& client)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last_sync) {
|
if (last_sync) {
|
||||||
OpenLogFile();
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue