Skip to content

Commit

Permalink
perf: avoid creating unused StepEventBuses (#3544)
Browse files Browse the repository at this point in the history
  • Loading branch information
hertzsprung authored Sep 24, 2024
1 parent d8d2925 commit 6fc140c
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ public static StepEventBus eventBusFor(Object key) {
if (key == null) {
return new SilentEventBus(ConfiguredEnvironment.getEnvironmentVariables());
}
STICKY_EVENT_BUSES.putIfAbsent(key, new StepEventBus(ConfiguredEnvironment.getEnvironmentVariables(),
ConfiguredEnvironment.getConfiguration()));
return STICKY_EVENT_BUSES.get(key);
return STICKY_EVENT_BUSES.computeIfAbsent(key, (unused) -> new StepEventBus(
ConfiguredEnvironment.getEnvironmentVariables(), ConfiguredEnvironment.getConfiguration()));
}

public static void setCurrentBusToEventBusFor(Object key) {
Expand Down

0 comments on commit 6fc140c

Please sign in to comment.