Skip to content

Commit

Permalink
Specializes the getBatchAsync method for dep prefetching.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 213183365
  • Loading branch information
aoeui authored and Copybara-Service committed Sep 16, 2018
1 parent 1f08d4c commit 5233993
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ public interface QueryableGraph {
return InterruptibleSupplier.Memoize.of(() -> getBatch(requestor, reason, keys));
}

/** Optimistically prefetches dependencies. */
default void prefetchDeps(@Nullable SkyKey requestor, Iterable<? extends SkyKey> depKeys)
throws InterruptedException {
getBatchAsync(requestor, Reason.PREFETCH, depKeys);
}

/**
* Examines all the given keys. Returns an iterable of keys whose corresponding nodes are
* currently available to be fetched.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,8 @@ private Map<SkyKey, SkyValue> batchPrefetch(
depKeysAsSet = depKeys.toSet();
evaluatorContext
.getGraph()
.getBatchAsync(
requestor,
Reason.PREFETCH,
Iterables.filter(oldDeps, Predicates.not(Predicates.in(depKeysAsSet))));
.prefetchDeps(
requestor, Iterables.filter(oldDeps, Predicates.not(Predicates.in(depKeysAsSet))));
}
}
Map<SkyKey, ? extends NodeEntry> batchMap =
Expand Down

0 comments on commit 5233993

Please sign in to comment.