broker::Manager: No more network_time forwarding

network_time forwarding will happen in the main-loop before draining the
EventMgr so timers/events scheduled based on broker messages should
behave similarly. This also keeps network_time unaffected during
non pseudo-realtime trace processing.
This commit is contained in:
Arne Welzel 2023-03-15 15:12:06 +01:00
parent c30b5cbc4d
commit 3269310e61

View file

@ -1140,11 +1140,6 @@ void Manager::DispatchMessage(const broker::topic& topic, broker::data msg)
void Manager::Process() void Manager::Process()
{ {
// Ensure that time gets update before processing broker messages, or events
// based on them might get scheduled wrong.
if ( use_real_time )
run_state::detail::update_network_time(util::current_time());
auto messages = bstate->subscriber.poll(); auto messages = bstate->subscriber.poll();
bool had_input = ! messages.empty(); bool had_input = ! messages.empty();
@ -1221,10 +1216,16 @@ void Manager::Process()
if ( had_input ) if ( had_input )
{ {
if ( run_state::network_time == 0 ) if ( run_state::network_time == 0 )
{
// If we're getting Broker messages, but still haven't initialized // If we're getting Broker messages, but still haven't initialized
// run_state::network_time, may as well do so now because otherwise the // run_state::network_time, may as well do so now because otherwise the
// broker/cluster logs will end up using timestamp 0. // broker/cluster logs will end up using timestamp 0.
run_state::detail::update_network_time(util::current_time()); //
// Do not do this when allow_network_time_forard is set to F
// with the assumption that this is unwanted behavior.
if ( get_option("allow_network_time_forward")->AsBool() )
run_state::detail::update_network_time(util::current_time());
}
} }
} }