Clean up SQLite replay log on logging

refs #7752
This commit is contained in:
Alexander A. Klimov 2020-04-09 16:48:20 +02:00
parent 8a335ce4e6
commit 95d41fba46

View File

@ -1159,8 +1159,18 @@ void ApiListener::PersistMessage(const Dictionary::Ptr& message, const ConfigObj
targetEndpoints.erase(GetLocalEndpoint());
auto now (Utility::GetTime());
for (auto& endpoint : targetEndpoints) {
if (ts > endpoint->GetLocalLogPosition()) {
{
auto logDuration (endpoint->GetLogDuration());
if (logDuration >= 0u) {
endpoint->GetReplayLog().Cleanup(now - logDuration);
}
}
endpoint->GetReplayLog().Log(ts, JsonEncode(message));
}
}