ReceiveCommits: Avoid use of secondary index in readChangesForReplace

This is a follow-up of Ifc83162780. Avoid using secondary index also
in readChangesForReplace() because the project attribute is always
available.

Change-Id: I9d0cc632d24a631c128715b79f7a620da99f61eb
This commit is contained in:
David Ostrovsky
2020-12-21 15:35:42 +01:00
parent ac5dd6e1a9
commit f70d917c67

View File

@@ -2691,12 +2691,10 @@ class ReceiveCommits {
private void readChangesForReplace() {
try (TraceTimer traceTimer = newTimer("readChangesForReplace")) {
Collection<ChangeNotes> allNotes =
notesFactory.createUsingIndexLookup(
replaceByChange.values().stream().map(r -> r.ontoChange).collect(toList()));
for (ChangeNotes notes : allNotes) {
replaceByChange.get(notes.getChangeId()).notes = notes;
}
replaceByChange.values().stream()
.map(r -> r.ontoChange)
.map(id -> notesFactory.create(project.getNameKey(), id))
.forEach(notes -> replaceByChange.get(notes.getChangeId()).notes = notes);
}
}