Skip to content

Commit

Permalink
Resolve fingerprint service asynchronously.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 695975233
Change-Id: I6212efa861c2f83b5dd0b6f3d3bfb21a14a40e22
  • Loading branch information
jin authored and copybara-github committed Nov 13, 2024
1 parent 471aca1 commit 60d1759
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@
import java.io.PrintStream;
import java.util.Collection;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import javax.annotation.Nullable;

/**
Expand Down Expand Up @@ -1096,10 +1099,10 @@ DetailedExitCode getDetailedExitCode() {
private static final class RemoteAnalysisCachingDependenciesProviderImpl
implements RemoteAnalysisCachingDependenciesProvider {
private final Supplier<ObjectCodecs> analysisObjectCodecsSupplier;
private final FingerprintValueService fingerprintValueService;
private final PathFragmentPrefixTrie activeDirectoriesMatcher;
private final RemoteAnalysisCachingEventListener listener;
private final HashCode blazeInstallMD5;
private final Future<FingerprintValueService> fingerprintValueServiceFuture;

// Non-final because the top level BuildConfigurationValue is determined just before analysis
// begins in BuildView for the download/deserialization pass, which is later than when this
Expand Down Expand Up @@ -1133,8 +1136,12 @@ private RemoteAnalysisCachingDependenciesProviderImpl(
.get(),
env.getRuntime().getRuleClassProvider(),
env.getBlazeWorkspace().getSkyframeExecutor()));
this.fingerprintValueService =
env.getBlazeWorkspace().getFingerprintValueServiceFactory().create(env.getOptions());
this.fingerprintValueServiceFuture =
CompletableFuture.supplyAsync(
() ->
env.getBlazeWorkspace()
.getFingerprintValueServiceFactory()
.create(env.getOptions()));
this.activeDirectoriesMatcher = activeDirectoriesMatcher;
this.listener = env.getRemoteAnalysisCachingEventListener();
if (env.getSkyframeBuildView().getBuildConfiguration() != null) {
Expand Down Expand Up @@ -1206,7 +1213,11 @@ public ObjectCodecs getObjectCodecs() {

@Override
public FingerprintValueService getFingerprintValueService() {
return fingerprintValueService;
try {
return fingerprintValueServiceFuture.get();
} catch (InterruptedException | ExecutionException e) {
throw new IllegalStateException("Unable to initialize fingerprint value service", e);
}
}

@Override
Expand Down

0 comments on commit 60d1759

Please sign in to comment.