[traffic] Update clear/purge logic to use update mechanism

Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
mvglasow
2025-06-15 20:46:25 +03:00
parent 26aa5e5f54
commit 173b5e1718
2 changed files with 17 additions and 3 deletions

View File

@@ -157,7 +157,6 @@ void TrafficManager::Clear()
#endif
m_messageCache.clear();
m_feedQueue.clear();
m_allMwmColoring.clear();
m_mwmCache.clear();
// TODO figure out which of the ones below we still need
@@ -411,6 +410,12 @@ void TrafficManager::Push(traffxml::TraffFeed feed)
}
void TrafficManager::PurgeExpiredMessages()
{
PurgeExpiredMessagesImpl();
OnTrafficDataUpdate();
}
void TrafficManager::PurgeExpiredMessagesImpl()
{
std::lock_guard<std::mutex> lock(m_mutex);
LOG(LINFO, ("before:", m_messageCache.size(), "message(s)"));
@@ -549,7 +554,7 @@ void TrafficManager::ThreadRoutine()
if (steady_clock::now() - lastPurged >= kPurgeInterval)
{
lastPurged == steady_clock::now();
PurgeExpiredMessages();
PurgeExpiredMessagesImpl();
}
LOG(LINFO, ("active MWMs changed:", m_activeMwmsChanged, ", poll needed:", m_isPollNeeded));