Invoke commandComplete before closing the profiler
Note that this requires --experimental_post_profile_started_event to be
false.
@@ -644,6 +644,12 @@ public final class BlazeRuntime implements BugReport.BlazeRuntimeInterface {
}
env.getBlazeWorkspace().clearEventBus();
+ for (BlazeModule module : blazeModules) {
+ try (SilentCloseable closeable = Profiler.instance().profile(module + ".commandComplete")) {
+ module.commandComplete();
+ }
+ }
+
try {
Profiler.instance().stop();
MemoryProfiler.instance().stop();
@@ -651,10 +657,6 @@ public final class BlazeRuntime implements BugReport.BlazeRuntimeInterface {
env.getReporter().handle(Event.error("Error while writing profile file: " + e.getMessage()));
}
- for (BlazeModule module : blazeModules) {
- module.commandComplete();
- }
-
env.getReporter().clearEventBus();
actionKeyContext.clear();
flushServerLog();
