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() { private void readChangesForReplace() {
try (TraceTimer traceTimer = newTimer("readChangesForReplace")) { try (TraceTimer traceTimer = newTimer("readChangesForReplace")) {
Collection<ChangeNotes> allNotes = replaceByChange.values().stream()
notesFactory.createUsingIndexLookup( .map(r -> r.ontoChange)
replaceByChange.values().stream().map(r -> r.ontoChange).collect(toList())); .map(id -> notesFactory.create(project.getNameKey(), id))
for (ChangeNotes notes : allNotes) { .forEach(notes -> replaceByChange.get(notes.getChangeId()).notes = notes);
replaceByChange.get(notes.getChangeId()).notes = notes;
}
} }
} }