BatchUpdate: Don't update change if there was nothing to do
Committing the transaction and indexing the change can be expensive, so allow ops to skip that if they did nothing. Similar to how updateRepo can be a no-op if no commands were added, except we don't communicate this through the context and instead through a return value. This is distinct from the insert/save/deleteChange methods on ChangeContext, which refer specifically to the Change entity; a method could update a non-Change entity and return true without calling saveChange. Change-Id: Id51eec8f9dfa35c80f062a365195f25777f60006
This commit is contained in:
@@ -1810,8 +1810,9 @@ public class ReceiveCommits {
|
||||
changeId,
|
||||
new BatchUpdate.Op() {
|
||||
@Override
|
||||
public void updateChange(ChangeContext ctx) throws Exception {
|
||||
public boolean updateChange(ChangeContext ctx) {
|
||||
ctx.getUpdate(psId).setTopic(magicBranch.topic);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user