Reuse cached RefControl data in FunctionState
Currently the FunctionState code is run for every change in a change listing in the web UI, or the user dashboard. Looking up the relevant permissions for each reviewer is costly, but can typically be cached and reused off the request's cache, as most changes are not on username specific references. Change-Id: Idff421e1eecf651db11549d6591484578cd9543c
This commit is contained in:
@@ -120,7 +120,7 @@ public class PublishComments implements Callable<VoidResult> {
|
||||
|
||||
final boolean isCurrent = patchSetId.equals(change.currentPatchSetId());
|
||||
if (isCurrent && change.getStatus().isOpen()) {
|
||||
publishApprovals();
|
||||
publishApprovals(ctl);
|
||||
} else if (! approvals.isEmpty()) {
|
||||
throw new InvalidChangeOperationException("Change is closed");
|
||||
} else {
|
||||
@@ -141,7 +141,7 @@ public class PublishComments implements Callable<VoidResult> {
|
||||
db.patchComments().update(drafts);
|
||||
}
|
||||
|
||||
private void publishApprovals() throws OrmException {
|
||||
private void publishApprovals(ChangeControl ctl) throws OrmException {
|
||||
ChangeUtil.updated(change);
|
||||
|
||||
final Set<ApprovalCategory.Id> dirty = new HashSet<ApprovalCategory.Id>();
|
||||
@@ -169,7 +169,7 @@ public class PublishComments implements Callable<VoidResult> {
|
||||
// Normalize all of the items the user is changing.
|
||||
//
|
||||
final FunctionState functionState =
|
||||
functionStateFactory.create(change, patchSetId, all);
|
||||
functionStateFactory.create(ctl, patchSetId, all);
|
||||
for (final ApprovalCategoryValue.Id want : approvals) {
|
||||
final PatchSetApproval a = mine.get(want.getParentKey());
|
||||
final short o = a.getValue();
|
||||
|
||||
Reference in New Issue
Block a user