Merge "Revert "ProjectCacheImpl#guessRelevantGroupUUIDs remove indirection over ListProjects""

This commit is contained in:
Patrick Hiesel
2020-08-06 08:19:10 +00:00
committed by Gerrit Code Review

View File

@@ -56,6 +56,7 @@ import com.google.inject.TypeLiteral;
import com.google.inject.name.Named;
import java.io.IOException;
import java.time.Duration;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ExecutionException;
@@ -223,7 +224,9 @@ public class ProjectCacheImpl implements ProjectCache {
@Override
public Set<AccountGroup.UUID> guessRelevantGroupUUIDs() {
try (Timer0.Context ignored = guessRelevantGroupsLatency.start()) {
return byName.asMap().values().stream()
return all().stream()
.map(n -> byName.getIfPresent(n))
.filter(Objects::nonNull)
.flatMap(p -> p.getConfig().getAllGroupUUIDs().stream())
// getAllGroupUUIDs shouldn't really return null UUIDs, but harden
// against them just in case there is a bug or corner case.