[traffic] Cache routing session state, introduce IsObserverInhibited()

Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
mvglasow
2025-11-08 16:32:28 +02:00
parent f7882636cd
commit 1d87e0e987
2 changed files with 24 additions and 16 deletions

View File

@@ -206,8 +206,7 @@ void TrafficManager::OnChangeRoutingSessionState(routing::SessionState previous,
LOG(LINFO, ("Routing session state changed from", previous, "to", current));
LOG(LINFO, ("Running on thread", std::this_thread::get_id()));
m_observerInhibited = ((current == routing::SessionState::RouteBuilding)
|| (current == routing::SessionState::RouteRebuilding));
m_routingSessionState = current;
/*
* Filter based on session state (see routing_callbacks.hpp for states and transitions).
@@ -806,7 +805,7 @@ void TrafficManager::OnTrafficDataUpdate()
auto const storageAge = currentTime - m_lastStorageUpdate;
notifyDrape = (drapeAge >= kDrapeUpdateInterval);
updateStorage = (storageAge >= kStorageUpdateInterval);
if (!m_observerInhibited)
if (!IsObserverInhibited())
{
/*
* To avoid resetting the route over and over again while building, inhibit periodic updates