Materialize IdentifiedUser deps in BatchUpdate

When executing BatchUpdates from a receive commit, materialise the user
dependent objects so that it can be passed over to other threads
for delayed execution outside the current scope.

P.S. This fixes Gerrit master breakages caused by OutOfScopeException.

Change-Id: Ic463ddaeb5d9c90573a3a4639523f214125aaaad
This commit is contained in:
Luca Milanesio
2016-12-28 11:05:50 +00:00
parent 1b44bb8430
commit a5539700b8
2 changed files with 25 additions and 2 deletions

View File

@@ -825,8 +825,9 @@ public class ReceiveCommits {
return;
}
try (BatchUpdate bu = batchUpdateFactory.create(db,
magicBranch.dest.getParentKey(), user, TimeUtil.nowTs());
try (BatchUpdate bu =
batchUpdateFactory.create(db, magicBranch.dest.getParentKey(),
user.materializedCopy(), TimeUtil.nowTs());
ObjectInserter ins = repo.newObjectInserter()) {
bu.setRepository(repo, rp.getRevWalk(), ins)
.updateChangesInParallel();