Skip to content

Commit

Permalink
fix(engine): sync outputs before printing stats at shutdown
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Guerra <[email protected]>
  • Loading branch information
LucaGuerra authored and poiana committed Sep 23, 2024
1 parent d3a67c1 commit 70c10ee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions userspace/falco/app/actions/process_events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 70c10ee

Please sign in to comment.