fix(engine): sync outputs before printing stats at shutdown

Signed-off-by: Luca Guerra <luca@guerra.sh>
This commit is contained in:
Luca Guerra 2024-09-20 15:55:16 +00:00 committed by poiana
parent d3a67c10bd
commit 70c10ee7e0

View File

@ -585,6 +585,12 @@ falco::app::run_result falco::app::actions::process_events(falco::app::state& s)
}
}
// By deleting s.outputs, we make sure that the engine will wait until
// regular output has been completely sent before printing stats, avoiding
// intermixed stats with output.
// Note that this will only work if this is the last reference held by the
// shared pointer.
s.outputs.reset();
s.engine->print_stats();
return res;